Bug #47103 | RBR slave crash in table_def::type when modifying a merge table | ||
---|---|---|---|
Submitted: | 3 Sep 2009 15:57 | Modified: | 31 Oct 2009 17:05 |
Reporter: | Matthias Leich | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Row Based Replication ( RBR ) | Severity: | S3 (Non-critical) |
Version: | 5.4 | OS: | Any |
Assigned to: | Luis Soares | CPU Architecture: | Any |
Tags: | merge, RBR, regression |
[3 Sep 2009 15:57]
Matthias Leich
[5 Sep 2009 10:10]
Philip Stoev
There is another test case, with DELETE: --source include/master-slave.inc CREATE TABLE `table0_int_autoinc` ( `int` int, pk integer auto_increment, `int_key` int, primary key (pk), key (`int_key` )); CREATE TABLE `table10_int_autoinc` ( `int` int, pk integer auto_increment, `int_key` int, primary key (pk), key (`int_key` )); INSERT IGNORE INTO table10_int_autoinc VALUES (NULL, NULL, '-474021888') , ('1', NULL, NULL) , ('1141047296', NULL, NULL) , (NULL, NULL, NULL) , (NULL, NULL, '1') , (NULL, NULL, '9') , ('0', NULL, '1225785344') , (NULL, NULL, '1574174720') , ('2', NULL, NULL) , ('6', NULL, '3'); CREATE TABLE IF NOT EXISTS t1_merge_1_A LIKE test . table0_int_autoinc; ALTER TABLE t1_merge_1_A ENGINE = MERGE UNION ( table10_int_autoinc , table0_int_autoinc); DELETE FROM t1_merge_1_A;
[21 Sep 2009 9:43]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/83860 2824 Luis Soares 2009-09-21 BUG#47103: RBR slave crash in table_def::type when modifying a merge table When applying the table map event, a tables_to_lock list is updated on the rli internal state. This list extends the regular TABLE_LIST, by adding extra properties: a flag and a table definition reference. These fields are used later, when applying a rows event, to check whether the table definition on the slave is compatible with the one existing on the master. The problem is that when the slave thread opens the tables, defined on tables_to_lock, it passes the tables_to_lock as a parameter to the function that will actually perform the open tables (simple_open_n_lock_tables). Internally, this function appends to the list, references to the tables that are part of the merge table, whithout filling the table definition portion. Consequently, the slave crashes later when verifying the table compatibility because, it accesses the uninitialized table definition data. We fix this, by testing the flag m_tabledef_valid before actuallly checking whether tables are compatible or not. Tables that have valid table definitions (were filled when applying Table map events), will have this flag set. @ mysql-test/suite/rpl/t/rpl_row_merge_engine.test Test case. @ sql/log_event.cc Deployed a check to m_tabledef_valid before actually verifying table compatibility.
[30 Sep 2009 0:45]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/85108 2824 Luis Soares 2009-09-30 BUG#47103: RBR slave crash in table_def::type when modifying a merge table When applying the table map event, a tables_to_lock list is updated on the rli internal state. This list extends the regular TABLE_LIST, by adding extra properties: a flag and a table definition reference. These fields are used later, when applying a rows event, to check whether the table definition on the slave is compatible with the one existing on the master. The problem is that when the slave thread opens the tables, defined on tables_to_lock, it passes the tables_to_lock as a parameter to the function that will actually perform the open tables (simple_open_n_lock_tables). Internally, this function appends to the list, references to the tables that are part of the merge table, whithout filling the table definition portion. Consequently, the slave crashes later when verifying the table compatibility because, it accesses the uninitialized table definition data. We fix this, by checking only the table definitions that were set when processing the table map event. We do this by iterating over the table list until we reach the tables_to_lock_count variable. Additionally, we also deploy an assertion so that every table that is eligible to for table definition comparison, is asserted to have m_tabledef_valid set. @ mysql-test/suite/rpl/t/rpl_row_merge_engine.test Test case. @ sql/log_event.cc Extended loop so that its stop condition now considers the number of tables got in the Table_map_event. Additionally, a DBUG_ASSERT was deployed so that every table selected to the comparison procedure is asserted to have the m_tabledef_valid set.
[1 Oct 2009 13:36]
Luis Soares
Checking, with a test case that combines both test from Matthias and Philip, against the development trees, I have found that: mysql-5.1-bugteam => Test SUCCEEDS mysql-next-mr => Test SUCCEEDS mysql-6.0-codebase-bugfixing => Test FAILS So, bug is only repeatable in mysql-6.0-codebase-bugfixing.
[1 Oct 2009 14:55]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/85398 2824 Luis Soares 2009-10-01 BUG#47103: RBR slave crash in table_def::type when modifying a merge table When applying the table map event, a tables_to_lock list is updated on the rli internal state. This list extends the regular TABLE_LIST, by adding extra properties: a flag and a table definition reference. These fields are used later, when applying a rows event, to check whether the table definition on the slave is compatible with the one existing on the master. The problem is that when the slave thread opens the tables, defined on tables_to_lock, it passes the tables_to_lock as a parameter to the function that will actually perform the open tables (simple_open_n_lock_tables). Internally, this function appends to the list, references to the tables that are part of the merge table, whithout filling the table definition portion. Consequently, the slave crashes later when verifying the table compatibility because, it accesses the uninitialized table definition data. We fix this, by checking only the table definitions that were set when processing the table map event. We do this by iterating over the table list until we reach the tables_to_lock_count variable. Additionally, we also deploy an assertion so that every table that is eligible to for table definition comparison, is asserted to have m_tabledef_valid set. @ mysql-test/suite/rpl/t/rpl_row_merge_engine.test The two test cases from bug report as well as more robust test case. @ sql/log_event.cc Extended loop so that its stop condition now considers the number of tables got in the Table_map_event. Additionally, a DBUG_ASSERT was deployed so that every table selected to the comparison procedure is asserted to have the m_tabledef_valid set.
[9 Oct 2009 9:56]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/86321 3651 Luis Soares 2009-10-09 [merge] BUG#47103: automerge 6.0-cb-bf local bug branch --> 6.0-cb-bf up to date.
[9 Oct 2009 10:01]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/86325 3653 Luis Soares 2009-10-09 [merge] BUG#47103: automerge 6.0-cb-bf local bug branch --> 6.0-cb-bf up to date.
[9 Oct 2009 10:03]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/86326 3654 Luis Soares 2009-10-09 [merge] BUG#47103: automerge 6.0-cb-bf local bug branch --> 6.0-cb-bf up to date.
[9 Oct 2009 10:04]
Luis Soares
Pushed to mysql-6.0-codebase-bugfixing.
[31 Oct 2009 8:17]
Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091031081410-qkxmjsdzjmj840aq) (version source revid:guilhem@mysql.com-20091010123356-qfouds7ucvkvbczt) (merge vers: 6.0.14-alpha) (pib:13)
[31 Oct 2009 17:05]
Jon Stephens
Documented bugfix in the 6.0.14 changelog as follows: Updates to MERGE tables when using row-based replication could cause the slave to crash. Closed.
[8 Jun 2011 19:54]
Sveta Smirnova
Fix for this bug have not been backported to 5.5 series: see bug #61450 also
[21 Jul 2011 7:04]
MySQL Verification Team
see bug #61932