mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 02:30:06 +01:00
580664b2c3
PROBLEM: After WL 4144, when using MyISAM Merge tables, the routine open_and_lock_tables will append to the list of tables to lock, the base tables that make up the MERGE table. This has two side-effects in replication: 1. On the master side, we log additional table maps for the base tables, since they appear in the list of locked tables, even though we don't really use them at the slave. 2. On the slave side, when opening a MERGE table while applying a ROW event, additional tables are appended to the list of tables to lock. Side-effect #1 is not harmful. It's just that when using MyISAM Merge tables a few table maps more may be logged. Side-effect #2, is harmful, because the list rli->tables_to_lock is an extended structure from TABLE_LIST in which the extra fields are filled from the table maps that are processed. Since open_and_lock_tables appends tables to the list after all table map events have been processed we end up with entries without replication/table map data on them. Thus when trying to access that info for these extra tables, the server will crash. SOLUTION: We fix side-effect #2 by making sure that we access the replication part of the structure for those in the list that were accounted for when processing the correspondent table map events. All in all, we never go beyond rli->tables_to_lock_count. We also deploy an assertion when clearing rli->tables_to_lock, making sure that the base tables are not in the list anymore (were closed in close_thread_tables).
50 lines
1.3 KiB
Text
50 lines
1.3 KiB
Text
#
|
|
# BUG#47103
|
|
#
|
|
# This test case checks whether the slave crashes or not when there is
|
|
# a merge table in use.
|
|
#
|
|
# Description
|
|
# ===========
|
|
#
|
|
# The test case creates two regular MyISAM tables on the master and
|
|
# one MERGE table. Then it populates the MyISAM tables, updates and
|
|
# deletes their contents through the merge table. Finally, the slave
|
|
# is synchronized with the master and (after the fix) it won't crash.
|
|
#
|
|
--source include/master-slave.inc
|
|
--source include/have_binlog_format_row.inc
|
|
--connection master
|
|
|
|
CREATE TABLE t1 (a int) ENGINE=MyISAM;
|
|
CREATE TABLE t2 (a int) ENGINE=MyISAM;
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
INSERT INTO t2 VALUES (4), (5), (6);
|
|
CREATE TABLE IF NOT EXISTS t1_merge LIKE t1;
|
|
ALTER TABLE t1_merge ENGINE=MERGE UNION (t2, t1);
|
|
|
|
--sync_slave_with_master
|
|
|
|
--let diff_tables=master:test.t1, slave:test.t1
|
|
--source include/diff_tables.inc
|
|
|
|
--let diff_tables=master:test.t2, slave:test.t2
|
|
--source include/diff_tables.inc
|
|
|
|
--connection master
|
|
UPDATE t1_merge SET a=10 WHERE a=1;
|
|
DELETE FROM t1_merge WHERE a=10;
|
|
|
|
--sync_slave_with_master
|
|
--connection master
|
|
|
|
--let diff_tables=master:test.t1, slave:test.t1
|
|
--source include/diff_tables.inc
|
|
|
|
--let diff_tables=master:test.t2, slave:test.t2
|
|
--source include/diff_tables.inc
|
|
|
|
DROP TABLE t1_merge, t1, t2;
|
|
--sync_slave_with_master
|
|
|
|
--source include/rpl_end.inc
|