summaryrefslogtreecommitdiff
path: root/sql/ha_ndbcluster.cc
diff options
context:
space:
mode:
authorunknown <mskold/marty@mysql.com/linux.site>2007-10-03 09:54:33 +0200
committerunknown <mskold/marty@mysql.com/linux.site>2007-10-03 09:54:33 +0200
commitd2a896802f830e7d43ecdefd373b05001374f5ed (patch)
tree07ea44cdbb7b5b22a7d520a00e498a79fec4a6da /sql/ha_ndbcluster.cc
parent1acfc89033164a676eb7c51955844760b29877cc (diff)
downloadmariadb-git-d2a896802f830e7d43ecdefd373b05001374f5ed.tar.gz
Bug#25817 UPDATE IGNORE doesn't check write_set when checking unique indexes: Post merge 5.0->5.1
Diffstat (limited to 'sql/ha_ndbcluster.cc')
-rw-r--r--sql/ha_ndbcluster.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 69512e5e7c7..b372849a183 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -1651,14 +1651,10 @@ bool ha_ndbcluster::check_index_fields_in_write_set(uint keyno)
uint i;
DBUG_ENTER("check_index_fields_in_write_set");
- if (m_retrieve_all_fields)
- {
- DBUG_RETURN(true);
- }
for (i= 0; key_part != end; key_part++, i++)
{
Field* field= key_part->field;
- if (field->query_id != current_thd->query_id)
+ if (!bitmap_is_set(table->write_set, field->field_index))
{
DBUG_RETURN(false);
}
@@ -1985,7 +1981,7 @@ check_null_in_record(const KEY* key_info, const uchar *record)
* primary key or unique index values
*/
-int ha_ndbcluster::peek_indexed_rows(const byte *record,
+int ha_ndbcluster::peek_indexed_rows(const uchar *record,
NDB_WRITE_OP write_op)
{
NdbTransaction *trans= m_active_trans;
@@ -1998,7 +1994,7 @@ int ha_ndbcluster::peek_indexed_rows(const byte *record,
NdbOperation::LockMode lm=
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
first= NULL;
- if (check_pk && table->s->primary_key != MAX_KEY)
+ if (write_op != NDB_UPDATE && table->s->primary_key != MAX_KEY)
{
/*
* Fetch any row with colliding primary key
@@ -2048,6 +2044,11 @@ int ha_ndbcluster::peek_indexed_rows(const byte *record,
DBUG_PRINT("info", ("skipping check for key with NULL"));
continue;
}
+ if (write_op != NDB_INSERT && !check_index_fields_in_write_set(i))
+ {
+ DBUG_PRINT("info", ("skipping check for key %u not in write_set", i));
+ continue;
+ }
NdbIndexOperation *iop;
const NDBINDEX *unique_index = m_index[i].unique_index;
key_part= key_info->key_part;