Commit ec4bb863 authored by mskold@mysql.com's avatar mskold@mysql.com

Changed delete_row to always get key from record argument

parent ff764e2b
...@@ -1113,12 +1113,12 @@ int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key) ...@@ -1113,12 +1113,12 @@ int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key)
} }
int ha_ndbcluster::set_primary_key_from_old_data(NdbOperation *op, const byte *old_data) int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const byte *old_data)
{ {
KEY* key_info= table->key_info + table->primary_key; KEY* key_info= table->key_info + table->primary_key;
KEY_PART_INFO* key_part= key_info->key_part; KEY_PART_INFO* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts; KEY_PART_INFO* end= key_part+key_info->key_parts;
DBUG_ENTER("set_primary_key_from_old_data"); DBUG_ENTER("set_primary_key_from_record");
for (; key_part != end; key_part++) for (; key_part != end; key_part++)
{ {
...@@ -1130,7 +1130,7 @@ int ha_ndbcluster::set_primary_key_from_old_data(NdbOperation *op, const byte *o ...@@ -1130,7 +1130,7 @@ int ha_ndbcluster::set_primary_key_from_old_data(NdbOperation *op, const byte *o
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/*
int ha_ndbcluster::set_primary_key(NdbOperation *op) int ha_ndbcluster::set_primary_key(NdbOperation *op)
{ {
DBUG_ENTER("set_primary_key"); DBUG_ENTER("set_primary_key");
...@@ -1147,7 +1147,7 @@ int ha_ndbcluster::set_primary_key(NdbOperation *op) ...@@ -1147,7 +1147,7 @@ int ha_ndbcluster::set_primary_key(NdbOperation *op)
} }
DBUG_RETURN(0); DBUG_RETURN(0);
} }
*/
/* /*
Read one record from NDB using primary key Read one record from NDB using primary key
...@@ -1242,7 +1242,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data) ...@@ -1242,7 +1242,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
ERR_RETURN(trans->getNdbError()); ERR_RETURN(trans->getNdbError());
int res; int res;
if ((res= set_primary_key_from_old_data(op, old_data))) if ((res= set_primary_key_from_record(op, old_data)))
ERR_RETURN(trans->getNdbError()); ERR_RETURN(trans->getNdbError());
// Read all unreferenced non-key field(s) // Read all unreferenced non-key field(s)
...@@ -1273,7 +1273,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data) ...@@ -1273,7 +1273,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
Peek to check if a particular row already exists Peek to check if a particular row already exists
*/ */
int ha_ndbcluster::peek_row() int ha_ndbcluster::peek_row(const byte *record)
{ {
NdbConnection *trans= m_active_trans; NdbConnection *trans= m_active_trans;
NdbOperation *op; NdbOperation *op;
...@@ -1287,7 +1287,7 @@ int ha_ndbcluster::peek_row() ...@@ -1287,7 +1287,7 @@ int ha_ndbcluster::peek_row()
ERR_RETURN(trans->getNdbError()); ERR_RETURN(trans->getNdbError());
int res; int res;
if ((res= set_primary_key(op))) if ((res= set_primary_key_from_record(op, record)))
ERR_RETURN(trans->getNdbError()); ERR_RETURN(trans->getNdbError());
if (execute_no_commit_ie(this,trans) != 0) if (execute_no_commit_ie(this,trans) != 0)
...@@ -1841,7 +1841,7 @@ int ha_ndbcluster::write_row(byte *record) ...@@ -1841,7 +1841,7 @@ int ha_ndbcluster::write_row(byte *record)
if(m_ignore_dup_key && table->primary_key != MAX_KEY) if(m_ignore_dup_key && table->primary_key != MAX_KEY)
{ {
int peek_res= peek_row(); int peek_res= peek_row(record);
if (!peek_res) if (!peek_res)
{ {
...@@ -1891,9 +1891,7 @@ int ha_ndbcluster::write_row(byte *record) ...@@ -1891,9 +1891,7 @@ int ha_ndbcluster::write_row(byte *record)
m_skip_auto_increment= !auto_increment_column_changed; m_skip_auto_increment= !auto_increment_column_changed;
} }
if ((res= (m_primary_key_update ? if ((res= set_primary_key_from_record(op, record)))
set_primary_key_from_old_data(op, record)
: set_primary_key(op))))
return res; return res;
} }
...@@ -2110,7 +2108,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) ...@@ -2110,7 +2108,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
else else
{ {
int res; int res;
if ((res= set_primary_key_from_old_data(op, old_data))) if ((res= set_primary_key_from_record(op, old_data)))
DBUG_RETURN(res); DBUG_RETURN(res);
} }
} }
...@@ -2191,10 +2189,8 @@ int ha_ndbcluster::delete_row(const byte *record) ...@@ -2191,10 +2189,8 @@ int ha_ndbcluster::delete_row(const byte *record)
else else
{ {
int res; int res;
if ((res= (m_primary_key_update ? if ((res= set_primary_key_from_record(op, record)))
set_primary_key_from_old_data(op, record) return res;
: set_primary_key(op))))
return res;
} }
} }
......
...@@ -168,7 +168,7 @@ class ha_ndbcluster: public handler ...@@ -168,7 +168,7 @@ class ha_ndbcluster: public handler
int pk_read(const byte *key, uint key_len, byte *buf); int pk_read(const byte *key, uint key_len, byte *buf);
int complemented_pk_read(const byte *old_data, byte *new_data); int complemented_pk_read(const byte *old_data, byte *new_data);
int peek_row(); int peek_row(const byte *record);
int unique_index_read(const byte *key, uint key_len, int unique_index_read(const byte *key, uint key_len,
byte *buf); byte *buf);
int ordered_index_scan(const key_range *start_key, int ordered_index_scan(const key_range *start_key,
...@@ -196,8 +196,7 @@ class ha_ndbcluster: public handler ...@@ -196,8 +196,7 @@ class ha_ndbcluster: public handler
friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg); friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg);
int get_ndb_blobs_value(NdbBlob *last_ndb_blob); int get_ndb_blobs_value(NdbBlob *last_ndb_blob);
int set_primary_key(NdbOperation *op, const byte *key); int set_primary_key(NdbOperation *op, const byte *key);
int set_primary_key(NdbOperation *op); int set_primary_key_from_record(NdbOperation *op, const byte *old_data);
int set_primary_key_from_old_data(NdbOperation *op, const byte *old_data);
int set_bounds(NdbIndexScanOperation *ndb_op, const key_range *keys[2]); int set_bounds(NdbIndexScanOperation *ndb_op, const key_range *keys[2]);
int key_cmp(uint keynr, const byte * old_row, const byte * new_row); int key_cmp(uint keynr, const byte * old_row, const byte * new_row);
void print_results(); void print_results();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment