mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 05:52:27 +01:00
41f7d13853
Table maps are now written on aquiring locks to tables and released at the end of each logical statement. mysql-test/extra/binlog_tests/ctype_cp932.test: Disabling cleanup code mysql-test/r/binlog_row_blackhole.result: Result change mysql-test/r/binlog_row_mix_innodb_myisam.result: Result change mysql-test/r/binlog_stm_ctype_cp932.result: Result change mysql-test/r/rpl_row_charset.result: Result change mysql-test/r/rpl_row_create_table.result: Result change mysql-test/t/rpl_row_create_table.test: Binlog position change sql/handler.cc: Writing table map after external_lock() sql/handler.h: Adding class for table operation hooks. sql/log.cc: Adding binlog_write_table_map() to THD. Removing write_table_map() from MYSQL_LOG. sql/log.h: Minor interface changes to move table map writing. sql/log_event.cc: Removing pre-allocation of memory for buffers. Allowing ULONG_MAX as table id denoting an event to ignore (only used to transfer flags). Adding code to collect tables while seeing table maps and lock collected tables when seeing a binrow event. Debriding code as a result of the above changes. sql/log_event.h: Minor interface changes. sql/mysql_priv.h: Adding hooks argument to create_table_from_items(). sql/parse_file.cc: Minor fix to avoid crash in debug printout. sql/rpl_rli.h: Adding list of tables to lock to RLI structure. sql/slave.cc: Using list of tables to lock from RLI structure. sql/sql_acl.cc: Removing redundant pending events flush. sql/sql_base.cc: Moving pending event flush. Using flag to guard to clear statement transaction only if this is the original open tables state. sql/sql_class.cc: Adding flag for open tables state. Removing redundant pending events flushes. Write a dummy event to indicate that the tables to lock should be emptied on the slave. sql/sql_class.h: Adding open tables state flags. Adding binlog_write_table_map() function to THD. Changes to select_create() to support new locking scheme. sql/sql_insert.cc: Adding rollback of statement transaction on error. It can now contain events after locking tables. sql/sql_load.cc: Removing redundant pending event flush. sql/sql_table.cc: Adding hooks argument to create_table_from_items(). Calling prelock hook before starting to lock tables. sql/sql_update.cc: Removing a compiler warning. sql/table.h: Minor changes.
108 lines
3.1 KiB
Text
108 lines
3.1 KiB
Text
# Testing table creations for row-based replication.
|
|
|
|
--source include/have_binlog_format_row.inc
|
|
--source include/master-slave.inc
|
|
|
|
--disable_query_log
|
|
--disable_warnings
|
|
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
--enable_warnings
|
|
--enable_query_log
|
|
|
|
# Set the default storage engine to different values on master and
|
|
# slave. We need to stop the slave for the server variable to take
|
|
# effect, since the variable is only read on start-up.
|
|
connection slave;
|
|
--disable_query_log
|
|
set @storage_engine = @@global.storage_engine;
|
|
STOP SLAVE;
|
|
SET GLOBAL storage_engine=memory;
|
|
START SLAVE;
|
|
--enable_query_log
|
|
|
|
connection master;
|
|
CREATE TABLE t1 (a INT, b INT);
|
|
CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
|
|
CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
|
|
CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
|
|
--replace_column 1 # 4 # 5 #
|
|
--query_vertical SHOW BINLOG EVENTS FROM 212
|
|
--echo **** On Master ****
|
|
--query_vertical SHOW CREATE TABLE t1
|
|
--query_vertical SHOW CREATE TABLE t2
|
|
--query_vertical SHOW CREATE TABLE t3
|
|
sync_slave_with_master;
|
|
--echo **** On Slave ****
|
|
--query_vertical SHOW CREATE TABLE t1
|
|
--query_vertical SHOW CREATE TABLE t2
|
|
--query_vertical SHOW CREATE TABLE t3
|
|
|
|
connection master;
|
|
CREATE TABLE t5 (b INT, c INT) SELECT * FROM t3;
|
|
|
|
CREATE TEMPORARY TABLE tt3 (a INT, b INT);
|
|
INSERT INTO tt3 VALUES (1,2), (2,4), (3,6), (4,2), (5,10), (6,12);
|
|
CREATE TABLE t6 (b INT, c INT) SELECT * FROM tt3;
|
|
--echo **** On Master ****
|
|
--query_vertical SHOW CREATE TABLE t5
|
|
SELECT * FROM t5 ORDER BY a,b,c;
|
|
--query_vertical SHOW CREATE TABLE t6
|
|
SELECT * FROM t6 ORDER BY a,b,c;
|
|
sync_slave_with_master;
|
|
--echo **** On Slave ****
|
|
--query_vertical SHOW CREATE TABLE t5
|
|
SELECT * FROM t5 ORDER BY a,b,c;
|
|
--query_vertical SHOW CREATE TABLE t6
|
|
SELECT * FROM t6 ORDER BY a,b,c;
|
|
|
|
connection master;
|
|
# Test for erroneous constructions
|
|
--error 1062
|
|
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
|
|
# Shouldn't be written to the binary log
|
|
SHOW BINLOG EVENTS FROM 1326;
|
|
|
|
# Test that INSERT-SELECT works the same way as for SBR.
|
|
CREATE TABLE t7 (a INT, b INT UNIQUE);
|
|
--error 1062
|
|
INSERT INTO t7 SELECT a,b FROM tt3;
|
|
SELECT * FROM t7 ORDER BY a,b;
|
|
# Should be written to the binary log
|
|
SHOW BINLOG EVENTS FROM 1326;
|
|
sync_slave_with_master;
|
|
SELECT * FROM t7 ORDER BY a,b;
|
|
|
|
connection master;
|
|
CREATE TEMPORARY TABLE tt4 (a INT, b INT);
|
|
INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
|
|
BEGIN;
|
|
INSERT INTO t7 SELECT a,b FROM tt4;
|
|
ROLLBACK;
|
|
SHOW BINLOG EVENTS FROM 1522;
|
|
SELECT * FROM t7 ORDER BY a,b;
|
|
sync_slave_with_master;
|
|
SELECT * FROM t7 ORDER BY a,b;
|
|
|
|
connection master;
|
|
CREATE TABLE t8 LIKE t4;
|
|
CREATE TABLE t9 LIKE tt4;
|
|
CREATE TEMPORARY TABLE tt5 LIKE t4;
|
|
CREATE TEMPORARY TABLE tt6 LIKE tt4;
|
|
--echo **** On Master ****
|
|
--query_vertical SHOW CREATE TABLE t8
|
|
--query_vertical SHOW CREATE TABLE t9
|
|
SHOW BINLOG EVENTS FROM 1618;
|
|
sync_slave_with_master;
|
|
--echo **** On Slave ****
|
|
--query_vertical SHOW CREATE TABLE t8
|
|
--query_vertical SHOW CREATE TABLE t9
|
|
|
|
connection master;
|
|
--disable_query_log
|
|
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
sync_slave_with_master;
|
|
# Here we reset the value of the default storage engine
|
|
STOP SLAVE;
|
|
SET GLOBAL storage_engine=@storage_engine;
|
|
START SLAVE;
|
|
--enable_query_log
|