Commit a7a24231 authored by rafal@quant.(none)'s avatar rafal@quant.(none)

Merge quant.(none):/ext/mysql/bk/mysql-5.1-bug21842-5.1.22

into  quant.(none):/ext/mysql/bk/mysql-5.1-bug21842-rpl
parents 4581efe9 3584a4d4
...@@ -7519,6 +7519,12 @@ int Rows_log_event::find_row(const Relay_log_info *rli) ...@@ -7519,6 +7519,12 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
*/ */
table->use_all_columns(); table->use_all_columns();
/*
Save copy of the record in table->record[1]. It might be needed
later if linear search is used to find exact match.
*/
store_record(table,record[1]);
if (table->s->keys > 0) if (table->s->keys > 0)
{ {
DBUG_PRINT("info",("locating record using primary key (index_read)")); DBUG_PRINT("info",("locating record using primary key (index_read)"));
...@@ -7552,8 +7558,9 @@ int Rows_log_event::find_row(const Relay_log_info *rli) ...@@ -7552,8 +7558,9 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
*/ */
my_ptrdiff_t const pos= my_ptrdiff_t const pos=
table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0; table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0;
table->record[1][pos]= 0xFF; table->record[0][pos]= 0xFF;
if ((error= table->file->index_read_map(table->record[1], m_key,
if ((error= table->file->index_read_map(table->record[0], m_key,
HA_WHOLE_KEY, HA_WHOLE_KEY,
HA_READ_KEY_EXACT))) HA_READ_KEY_EXACT)))
{ {
...@@ -7593,8 +7600,8 @@ int Rows_log_event::find_row(const Relay_log_info *rli) ...@@ -7593,8 +7600,8 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
/* /*
In case key is not unique, we still have to iterate over records found In case key is not unique, we still have to iterate over records found
and find the one which is identical to the row given. The row is unpacked and find the one which is identical to the row given. A copy of the
in record[1] where missing columns are filled with default values. record we are looking for is stored in record[1].
*/ */
DBUG_PRINT("info",("non-unique index, scanning it to find matching record")); DBUG_PRINT("info",("non-unique index, scanning it to find matching record"));
...@@ -7611,11 +7618,11 @@ int Rows_log_event::find_row(const Relay_log_info *rli) ...@@ -7611,11 +7618,11 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
*/ */
if (table->s->null_bytes > 0) if (table->s->null_bytes > 0)
{ {
table->record[1][table->s->null_bytes - 1]|= table->record[0][table->s->null_bytes - 1]|=
256U - (1U << table->s->last_null_bit_pos); 256U - (1U << table->s->last_null_bit_pos);
} }
if ((error= table->file->index_next(table->record[1]))) if ((error= table->file->index_next(table->record[0])))
{ {
DBUG_PRINT("info",("no record matching the given row found")); DBUG_PRINT("info",("no record matching the given row found"));
table->file->print_error(error, MYF(0)); table->file->print_error(error, MYF(0));
...@@ -7647,13 +7654,11 @@ int Rows_log_event::find_row(const Relay_log_info *rli) ...@@ -7647,13 +7654,11 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
/* Continue until we find the right record or have made a full loop */ /* Continue until we find the right record or have made a full loop */
do do
{ {
error= table->file->rnd_next(table->record[1]); error= table->file->rnd_next(table->record[0]);
switch (error) { switch (error) {
case 0: case 0:
DBUG_DUMP("record found", table->record[0], table->s->reclength);
case HA_ERR_RECORD_DELETED: case HA_ERR_RECORD_DELETED:
break; break;
...@@ -7682,6 +7687,8 @@ int Rows_log_event::find_row(const Relay_log_info *rli) ...@@ -7682,6 +7687,8 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
*/ */
if (restart_count == 2) if (restart_count == 2)
DBUG_PRINT("info", ("Record not found")); DBUG_PRINT("info", ("Record not found"));
else
DBUG_DUMP("record found", table->record[0], table->s->reclength);
table->file->ha_rnd_end(); table->file->ha_rnd_end();
DBUG_ASSERT(error == HA_ERR_END_OF_FILE || error == 0); DBUG_ASSERT(error == HA_ERR_END_OF_FILE || error == 0);
......
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