summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorMats Kindahl <mats@sun.com>2008-10-23 21:27:09 +0200
committerMats Kindahl <mats@sun.com>2008-10-23 21:27:09 +0200
commit32c161f3ea7314051090fb02eca03ef347394010 (patch)
tree09212d65be943c6c5dfd6d6a834841683d81f9f8 /sql/log_event.cc
parent3be6d967c5d04fa6dbeab1c25f28673d3abf8433 (diff)
parente291aab7da9587f742291e7cc5e10e568846066e (diff)
downloadmariadb-git-32c161f3ea7314051090fb02eca03ef347394010.tar.gz
Merging 5.1 main into 5.1-rpl
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc31
1 files changed, 25 insertions, 6 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 1547c999eea..1e7b6d1854d 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -3349,6 +3349,17 @@ int Start_log_event_v3::do_apply_event(Relay_log_info const *rli)
close_temporary_tables(thd);
cleanup_load_tmpdir();
}
+ else
+ {
+ /*
+ Set all temporary tables thread references to the current thread
+ as they may point to the "old" SQL slave thread in case of its
+ restart.
+ */
+ TABLE *table;
+ for (table= thd->temporary_tables; table; table= table->next)
+ table->in_use= thd;
+ }
break;
/*
@@ -8061,7 +8072,6 @@ Write_rows_log_event::do_before_row_operations(const Slave_reporting_capability
*/
}
- m_table->file->ha_start_bulk_insert(0);
/*
We need TIMESTAMP_NO_AUTO_SET otherwise ha_write_row() will not use fill
any TIMESTAMP column with data from the row but instead will use
@@ -8200,7 +8210,16 @@ Rows_log_event::write_row(const Relay_log_info *const rli,
/* unpack row into table->record[0] */
error= unpack_current_row(rli); // TODO: how to handle errors?
-
+ if (m_curr_row == m_rows_buf)
+ {
+ /* this is the first row to be inserted, we estimate the rows with
+ the size of the first row and use that value to initialize
+ storage engine for bulk insertion */
+ ulong estimated_rows= (m_rows_end - m_curr_row) / (m_curr_row_end - m_curr_row);
+ m_table->file->ha_start_bulk_insert(estimated_rows);
+ }
+
+
#ifndef DBUG_OFF
DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
DBUG_PRINT_BITSET("debug", "write_set = %s", table->write_set);
@@ -8605,10 +8624,10 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
the necessary bits on the bytes and don't set the filler bits
correctly.
*/
- my_ptrdiff_t const pos=
- table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0;
- table->record[0][pos]= 0xFF;
-
+ if (table->s->null_bytes > 0)
+ table->record[0][table->s->null_bytes - 1]|=
+ 256U - (1U << table->s->last_null_bit_pos);
+
if ((error= table->file->index_read_map(table->record[0], m_key,
HA_WHOLE_KEY,
HA_READ_KEY_EXACT)))