Current Path : /usr/opt/mysql57/mysql-test/suite/group_replication/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/mysql57/mysql-test/suite/group_replication/t/gr_ddl_no_autocommit.test |
################################################################################ # Validate Group Replication correct behaviour when present to DDL and # autocommit= 0. # # Test: # 0. The test requires two servers: M1 and M2. # 1. With all members ONLINE. On M1 firstly create tables and insert data, then # execute several DDL statements when autocommit=0. DDL cases:- # - CREATE TRIGGER # - DROP TRIGGER # - CREATE INDEX # - DROP INDEX # 2. Check consistency by comparing data and gtid_executed set in M1 and M2. # 3. Check binlog events on both M1 and M2. # 4. Clean up. ################################################################################ --source ../inc/have_group_replication_plugin.inc --source ../inc/group_replication.inc --echo --echo ############################################################# --echo # EXECUTE SEVERAL DDL STATEMENTS WHEN AUTOCOMMIT= 0 --echo ############################################################# --connection server1 CREATE TABLE tt_1 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE=InnoDB; CREATE TABLE tt_2 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE=InnoDB; INSERT INTO tt_1(ddl_case) VALUES(0); INSERT INTO tt_2(ddl_case) VALUES(0); SET AUTOCOMMIT= 0; --let $ddl_cases= 4 while ($ddl_cases >= 1) { --echo --echo ############################################################# --echo # DDL case: $ddl_cases --disable_query_log --let $first_binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1) --enable_query_log --eval INSERT INTO tt_1(ddl_case) VALUES ($ddl_cases) if ($ddl_cases == 4) { --let $cmd= CREATE TRIGGER tr AFTER INSERT ON tt_1 FOR EACH ROW UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case } if ($ddl_cases == 3) { --let $cmd= DROP TRIGGER tr } if ($ddl_cases == 2) { --let $cmd= CREATE INDEX ix ON tt_1(ddl_case) } if ($ddl_cases == 1) { --let $cmd= DROP INDEX ix ON tt_1 } --eval $cmd --disable_query_log --let $event_commit= query_get_value("SHOW BINLOG EVENTS FROM $first_binlog_position", Info, 4) --enable_query_log --let $binlog_start= $first_binlog_position; --source include/show_binlog_events.inc --dec $ddl_cases } SET AUTOCOMMIT= 1; --echo --echo ############################################################# --echo # CHECK CONSISTENCY --echo ############################################################# --source include/rpl_sync.inc --let $diff_tables= server1:tt_1,server2:tt_1 --source include/diff_tables.inc --connection server1 --let $server1_gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED` --connection server2 --let $server2_gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED` --let $assert_text= 'server1 and server2 GTID_EXECUTED must be equal' --let $assert_cond= "$server1_gtid_executed" = "$server2_gtid_executed" --source include/assert.inc --echo --echo ############################################################# --echo # BINLOG CONTENT --echo ############################################################# --echo SERVER 1 --connection server1 --let $binlog_start= --let $keep_gtid_events= 1 --source include/show_binlog_events.inc --echo SERVER 2 --connection server2 --source include/show_binlog_events.inc --echo --echo ############################################################# --echo # CLEAN --echo ############################################################# DROP TABLE tt_1; DROP TABLE tt_2; --source ../inc/group_replication_end.inc