summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorunknown <mats@mysql.com>2006-03-23 20:13:44 +0100
committerunknown <mats@mysql.com>2006-03-23 20:13:44 +0100
commite40dbfa847a3263920debde1ca650063a4c0d002 (patch)
tree394119fc189a6edac8fcaf85b50586403dc36e7e /sql/log_event.cc
parentdfa9a7641104686b588af016aa58cf46a9db093f (diff)
downloadmariadb-git-e40dbfa847a3263920debde1ca650063a4c0d002.tar.gz
Bug#18436 (RBR: Replication to partition engine triggers assertion on slave side):
Partial fix for resolving the problem. Swapping contents of record[0] and record[1] since this is what some storage engines expect. sql/handler.cc: Adding assertion to get early failure. sql/log_event.cc: Correcting code so that new record is passed in record[0] and old record is passed in record[1] when calling update_row(). mysql-test/r/rpl_row_basic_8partition.result: New BitKeeper file ``mysql-test/r/rpl_row_basic_8partition.result'' mysql-test/t/rpl_row_basic_8partition.test: New BitKeeper file ``mysql-test/t/rpl_row_basic_8partition.test''
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index d7ad9501ffd..a5f9b28de32 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -6402,7 +6402,7 @@ static int find_and_fetch_row(TABLE *table, byte *key)
table->record[0] if the engine allows it. We first compute a
row reference using the position() member function (it will be
stored in table->file->ref) and the use rnd_pos() to position
- the "cursor" at the correct row.
+ the "cursor" (i.e., record[0] in this case) at the correct row.
*/
table->file->position(table->record[0]);
DBUG_RETURN(table->file->rnd_pos(table->record[0], table->file->ref));
@@ -6797,19 +6797,25 @@ int Update_rows_log_event::do_exec_row(TABLE *table)
return error;
/*
- This is only a precaution to make sure that the call to
- ha_update_row is using record[1].
-
- If this is not needed/required, then we could use m_after_image in
- that call instead.
+ We have to ensure that the new record (i.e., the after image) is
+ in record[0] and the old record (i.e., the before image) is in
+ record[1]. This since some storage engines require this (for
+ example, the partition engine).
+
+ Since find_and_fetch_row() puts the fetched record (i.e., the old
+ record) in record[0], we have to move it out of the way and into
+ record[1]. After that, we can put the new record (i.e., the after
+ image) into record[0].
*/
- bmove_align(table->record[1], m_after_image,(size_t) table->s->reclength);
+ bmove_align(table->record[1], table->record[0], table->s->reclength);
+ bmove_align(table->record[0], m_after_image, table->s->reclength);
/*
- Now we should have the right row to update. The record that has
- been fetched is guaranteed to be in record[0], so we use that.
+ Now we should have the right row to update. The old row (the one
+ we're looking for) has to be in record[1] and the new row has to
+ be in record[0] for all storage engines to work correctly.
*/
- error= table->file->ha_update_row(table->record[0], table->record[1]);
+ error= table->file->ha_update_row(table->record[1], table->record[0]);
return error;
}