diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2015-05-29 17:19:53 +0300 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2015-06-30 13:17:09 +0300 |
commit | d817267ae6469f3cccbe08a55c5d10afd1bdb42f (patch) | |
tree | e5e2e679877197de8c381215c793c778282be57a /sql/log_event.cc | |
parent | 50955075bba0c9623f362dce9496fa914ff45df5 (diff) | |
download | mariadb-git-10.1-MDEV-6877-binlog_row_image.tar.gz |
[MDEV-6877] Change replication event loop to account for empty events10.1-MDEV-6877-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.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index ba785fe2239..802ad1e8f3b 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -9907,7 +9907,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; @@ -9955,18 +9955,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. @@ -11395,7 +11391,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); } |