summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2015-05-29 17:19:53 +0300
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2015-06-22 10:35:48 +0300
commitd1634c66ea85a7388ac54799613feb30e8733848 (patch)
treea9fee95a6fc87b96c27f303fe9119d9b3904dd51 /sql/log_event.cc
parent563e35ad27ac315548e47b40c72b5ec2e4bc9250 (diff)
downloadmariadb-git-bb-10.1-binlog_row_image.tar.gz
[MDEV-6877] Change replication event loop to account for empty eventsbb-10.1-binlog_row_image
When writing rows with a minimal row image, it is possible to receive empty events. In that case m_curr_row and m_rows_end are the same, however the event implies an insert into the table with the default values associated for that table.
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index c86c59ebd5b..be54181a8ef 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -9901,7 +9901,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
rgi->set_row_stmt_start_timestamp();
THD_STAGE_INFO(thd, stage_executing);
- while (error == 0 && m_curr_row < m_rows_end)
+ do
{
/* in_use can have been set to NULL in close_tables_for_reopen */
THD* old_thd= table->in_use;
@@ -9949,18 +9949,14 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
if (!m_curr_row_end && !error)
error= unpack_current_row(rgi);
-
- // at this moment m_curr_row_end should be set
- DBUG_ASSERT(error || m_curr_row_end != NULL);
- DBUG_ASSERT(error || m_curr_row < m_curr_row_end);
- DBUG_ASSERT(error || m_curr_row_end <= m_rows_end);
-
+
m_curr_row= m_curr_row_end;
if (error == 0 && !transactional_table)
thd->transaction.all.modified_non_trans_table=
thd->transaction.stmt.modified_non_trans_table= TRUE;
} // row processing loop
+ while (error == 0 && (m_curr_row != m_rows_end));
/*
Restore the sql_mode after the rows event is processed.
@@ -11389,7 +11385,16 @@ Rows_log_event::write_row(rpl_group_info *rgi,
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);
+ /* 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 */
+ DBUG_ASSERT(!(m_curr_row > m_curr_row_end));
+ ulong estimated_rows= 0;
+ if (m_curr_row < m_curr_row_end)
+ estimated_rows= (m_rows_end - m_curr_row) / (m_curr_row_end - m_curr_row);
+ else if (m_curr_row == m_curr_row_end)
+ estimated_rows= 1;
+
table->file->ha_start_bulk_insert(estimated_rows);
}