1# ==== Purpose ==== 2# 3# This include is meant to be used with 4# group_replication_parallel_applier_indexes_commit_order test, 5# please read it for details. 6# 7# 8# ==== Usage ==== 9# 10# --let $server_number= # 11# --source ../inc/gr_mts_indexes_commit_order_validation.inc 12# 13# Parameters: 14# $server_number 15# Server number to connect to. 16 17--echo 18--echo # include/gr_mts_indexes_commit_order_validation.inc 19--echo # Parameters: server_number: $server_number 20 21if ($server_number == '') 22{ 23 --die ERROR IN TEST: the "server_number" variable must be set 24} 25 26if ($logical_timestamps == '') 27{ 28--die ERROR IN TEST: the "logical_timestamps" variable must be set 29} 30 31--let $rpl_connection_name= server$server_number 32--source include/rpl_connection.inc 33 34--echo 35--echo # Assert parallel indexes, the 4 groups of transactions 36--echo # must be parallel. 37--let $binlog_file= server-relay-log-group_replication_applier.000002 38--source include/assert_logical_timestamps.inc 39 40# Stop Group Replication since we will do local operations. 41--source include/stop_group_replication.inc 42 43--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) 44--let $DATADIR= `SELECT @@DATADIR` 45--copy_file $DATADIR/$binlog_file $MYSQL_TMP_DIR/$binlog_file 46 47--echo 48--echo # Binary log will be reapplied one by one later through mysql. The 49--echo # table is recreated with an extra auto increment field. The new 50--echo # field 'id' will be filled by server automatically when reapplying 51--echo # binary log. So it exactly records the binlogging order of the 52--echo # transactions. 53--echo # 54DROP TABLE t1; 55CREATE TABLE t1 (a INT, id INT AUTO_INCREMENT KEY) ENGINE = InnoDB; 56 57--echo 58--echo # Clear GTID_EXECUTED to avoid that transactions reapplied 59--echo # from binary log are skipped. 60--echo # 61RESET MASTER; 62 63--echo 64--echo # Replay binary log. 65--echo # 66--let $mysql_server= $MYSQL --defaults-group-suffix=.$server_number 67--exec $MYSQL_BINLOG $MYSQL_TMP_DIR/$binlog_file | $mysql_server 68 69--echo 70--echo # The transactions should be binlogged in the same order as 71--echo # they are binlogged on server 1. 72--echo # Because the transactions: 73--echo # * insert numbers starting from 1; 74--echo # * id starts from 1; 75--echo # * both are increased by 1 for each transaction; 76--echo # the table's data should look like: 77--echo # id a 78--echo # 1 1 79--echo # 2 2 80--echo # ... ... 81--echo # n n 82--echo # It means the values of field 'id' are always same to the 83--echo # values of field 'a'. 84SELECT * FROM t1 WHERE id <> a; 85 86--let $assert_text= 'There are no mismatched rows' 87--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.id <> t1.a, count, 1] = 0 88--source include/assert.inc 89 90--let $assert_text= 'There are no row which is null' 91--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.a is NULL, count, 1] <= 0 92--source include/assert.inc 93 94--let $assert_text= 'There are 16 rows' 95--let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 16 96--source include/assert.inc 97 98DROP TABLE t1; 99--remove_file $MYSQL_TMP_DIR/$binlog_file 100