summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2008-09-29 14:42:36 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2008-09-29 14:42:36 -0300
commit2714b57bd3ecebecbdd51bf42a4c0c41972d3a04 (patch)
treefd69145d368c604f04a5830b767b5d185e143dfa
parent0406d409ea8550073465c1744425c599d0107553 (diff)
parenta2841cf1c17cd3b6487225d2723974130e8eeafd (diff)
downloadmariadb-git-2714b57bd3ecebecbdd51bf42a4c0c41972d3a04.tar.gz
Merge from parent branch.
-rw-r--r--sql/log_event.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 27e81c8ecd3..fe9eba81f80 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -8061,7 +8061,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 +8199,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);