diff options
author | unknown <Dao-Gang.Qu@sun.com> | 2010-12-21 12:47:22 +0800 |
---|---|---|
committer | unknown <Dao-Gang.Qu@sun.com> | 2010-12-21 12:47:22 +0800 |
commit | d5bf6b8aa8bb1c745abeb5e245f0398858ca1461 (patch) | |
tree | 582cd18c9cdb2cea87750c90512beb4119576d14 /sql/log_event.h | |
parent | 1a3d5fbfc7aa45463354b57586e24a630727c73e (diff) | |
download | mariadb-git-d5bf6b8aa8bb1c745abeb5e245f0398858ca1461.tar.gz |
Bug #56662 Assertion failed: next_insert_id == 0, file .\handler.cc
Normally, auto_increment value is generated for the column by
inserting either NULL or 0 into it. NO_AUTO_VALUE_ON_ZERO
suppresses this behavior for 0 so that only NULL generates
the auto_increment value. This behavior is also followed by
a slave, specifically by the SQL Thread, when applying events
in the statement format from a master. However, when applying
events in the row format, the flag was ignored thus causing
an assertion failure:
"Assertion failed: next_insert_id == 0, file .\handler.cc"
In fact, we never need to generate a auto_increment value for
the column when applying events in row format on slave. So we
don't allow it to happen by using 'MODE_NO_AUTO_VALUE_ON_ZERO'.
Refactoring: Get rid of all the sql_mode checks to rows_log_event
when applying it for avoiding problems caused by the inconsistency
of the sql_mode on slave and master as the sql_mode is not set for
Rows_log_event.
mysql-test/extra/rpl_tests/rpl_auto_increment.test:
Added test to verify if the assertion of "next_insert_id == 0"
will fail in ha_external_lock() function.
mysql-test/suite/rpl/r/rpl_auto_increment.result:
Test result for bug#56662.
sql/log_event.cc:
Added code to not allow generation of auto_increment value when
processing rows event by adding 'MODE_NO_AUTO_VALUE_ON_ZERO' to
sql_mode.
sql/rpl_record.cc:
Added code to get rid of the 'MODE_STRICT_TRANS_TABLES' and
MODE_STRICT_ALL_TABLES check to the table when appling the
rows event and treat it as no strict.
Diffstat (limited to 'sql/log_event.h')
-rw-r--r-- | sql/log_event.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sql/log_event.h b/sql/log_event.h index 75f2015a684..010658e930a 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -3583,16 +3583,13 @@ protected: int write_row(const Relay_log_info *const, const bool); // Unpack the current row into m_table->record[0] - int unpack_current_row(const Relay_log_info *const rli, - const bool abort_on_warning= TRUE) - { + int unpack_current_row(const Relay_log_info *const rli) + { DBUG_ASSERT(m_table); - bool first_row= (m_curr_row == m_rows_buf); ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT); int const result= ::unpack_row(rli, m_table, m_width, m_curr_row, &m_cols, - &m_curr_row_end, &m_master_reclength, - abort_on_warning, first_row); + &m_curr_row_end, &m_master_reclength); if (m_curr_row_end > m_rows_end) my_error(ER_SLAVE_CORRUPT_EVENT, MYF(0)); ASSERT_OR_RETURN_ERROR(m_curr_row_end <= m_rows_end, HA_ERR_CORRUPT_EVENT); |