summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormskold@mysql.com <>2005-07-06 11:39:48 +0200
committermskold@mysql.com <>2005-07-06 11:39:48 +0200
commitfe73e69b4e09f26424b5d558116c26cd8fff18ee (patch)
tree6d112c6b461fa038ada62b0a65647444ca064e4b /sql
parent883efd7e243738ef9833ef5e4d49b2ebe313c6a4 (diff)
parent7063d85bf9f738a84cfec94fee06d3c05eef8865 (diff)
downloadmariadb-git-fe73e69b4e09f26424b5d558116c26cd8fff18ee.tar.gz
Merge mysql.com:/usr/local/home/marty/MySQL/mysql-4.1
into mysql.com:/usr/local/home/marty/MySQL/mysql-5.0
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_ndbcluster.cc15
-rw-r--r--sql/ha_ndbcluster.h2
2 files changed, 11 insertions, 6 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index d26c92401dc..27019c94284 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -1249,7 +1249,7 @@ int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key)
}
-int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const byte *old_data)
+int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const byte *record)
{
KEY* key_info= table->key_info + table->s->primary_key;
KEY_PART_INFO* key_part= key_info->key_part;
@@ -1260,7 +1260,7 @@ int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const byte *old
{
Field* field= key_part->field;
if (set_ndb_key(op, field,
- key_part->fieldnr-1, old_data+key_part->offset))
+ key_part->fieldnr-1, record+key_part->offset))
ERR_RETURN(op->getNdbError());
}
DBUG_RETURN(0);
@@ -2102,7 +2102,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
if ((table->s->primary_key != MAX_KEY) &&
(key_cmp(table->s->primary_key, old_data, new_data)))
{
- int read_res, insert_res, delete_res;
+ int read_res, insert_res, delete_res, undo_res;
DBUG_PRINT("info", ("primary key update, doing pk read+delete+insert"));
// Get all old fields, since we optimize away fields not in query
@@ -2131,9 +2131,14 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
DBUG_PRINT("info", ("insert failed"));
if (trans->commitStatus() == NdbConnection::Started)
{
- // Undo write_row(new_data)
+ // Undo delete_row(old_data)
m_primary_key_update= TRUE;
- insert_res= write_row((byte *)old_data);
+ undo_res= write_row((byte *)old_data);
+ if (undo_res)
+ push_warning(current_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ undo_res,
+ "NDB failed undoing delete at primary key update");
m_primary_key_update= FALSE;
}
DBUG_RETURN(insert_res);
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index b75853dd5d0..b34f8dd063c 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -580,7 +580,7 @@ private:
friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg);
int get_ndb_blobs_value(NdbBlob *last_ndb_blob);
int set_primary_key(NdbOperation *op, const byte *key);
- int set_primary_key_from_record(NdbOperation *op, const byte *old_data);
+ int set_primary_key_from_record(NdbOperation *op, const byte *record);
int set_bounds(NdbIndexScanOperation*, const key_range *keys[2], uint= 0);
int key_cmp(uint keynr, const byte * old_row, const byte * new_row);
int set_index_key(NdbOperation *, const KEY *key_info, const byte *key_ptr);