summaryrefslogtreecommitdiff
path: root/mysql-test/include
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-07-07 12:39:43 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-07-07 12:39:43 +0300
commit57fea53615b9996b79a2945c4d5a7442ccb24d85 (patch)
tree3e3b13b1ae70cb80b5d4f14907e70e5c771a7026 /mysql-test/include
parent7fee164faf8fce7be4ebe322d2178efd3d075eae (diff)
parent9e53a6bdfddaf0288ed34be272570cd7a304d01e (diff)
downloadmariadb-git-57fea53615b9996b79a2945c4d5a7442ccb24d85.tar.gz
Merge bb-10.2-ext into 10.3
Diffstat (limited to 'mysql-test/include')
-rw-r--r--mysql-test/include/binlog_parallel_replication_marks.test81
1 files changed, 81 insertions, 0 deletions
diff --git a/mysql-test/include/binlog_parallel_replication_marks.test b/mysql-test/include/binlog_parallel_replication_marks.test
new file mode 100644
index 00000000000..b915d26ce99
--- /dev/null
+++ b/mysql-test/include/binlog_parallel_replication_marks.test
@@ -0,0 +1,81 @@
+# Test the markings on GTID events (ddl, waited, trans,
+# @@skip_parallel_replication) that are used to control parallel
+# replication on the slave.
+
+--source include/have_innodb.inc
+
+RESET MASTER;
+--source include/wait_for_binlog_checkpoint.inc
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+--let $binlog_pos1=query_get_value(SHOW MASTER STATUS, Position, 1)
+/* GTID */ INSERT INTO t1 VALUES (1,0);
+/* GTID */ BEGIN;
+/* GTID */ INSERT INTO t1 VALUES (2,0);
+/* GTID */ ALTER TABLE t1 ADD c INT;
+/* GTID */ INSERT INTO t1 VALUES (3,0,0);
+/* GTID */ COMMIT;
+/* GTID */ BEGIN;
+/* GTID */ UPDATE t1 SET b=1, c=1 WHERE a=2;
+/* GTID */ CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+/* GTID */ INSERT INTO t2 VALUES (4,10), (5,20);
+/* GTID */ INSERT INTO t1 SELECT a, 2, b FROM t2;
+/* GTID */ DROP TEMPORARY TABLE t2;
+/* GTID */ INSERT INTO t1 VALUES (6, 3, 0);
+/* GTID */ COMMIT;
+/* GTID */ CREATE TEMPORARY TABLE t3 (a INT PRIMARY KEY) ENGINE=InnoDB;
+/* GTID */ BEGIN;
+/* GTID */ DELETE FROM t1 WHERE a=5;
+/* GTID */ INSERT INTO t3 VALUES (7);
+/* GTID */ INSERT INTO t1 SELECT a, 4, 0 FROM t3;
+/* GTID */ UPDATE t1 SET c=1 WHERE a=7;
+/* GTID */ DROP TEMPORARY TABLE t3;
+/* GTID */ COMMIT;
+/* GTID */ CREATE TEMPORARY TABLE t4 (a INT PRIMARY KEY) ENGINE=InnoDB;
+/* GTID */ BEGIN;
+/* GTID */ INSERT INTO t1 VALUES (8, 5, 0);
+/* GTID */ ALTER TABLE t4 ADD b INT;
+/* GTID */ INSERT INTO t1 VALUES (9, 5, 1);
+/* GTID */ COMMIT;
+connect (tmp_con,localhost,root,,);
+/* GTID */ INSERT INTO t1 VALUES (10, 6, 0);
+/* GTID */ BEGIN;
+/* GTID */ CREATE TEMPORARY TABLE t5 (a INT PRIMARY KEY) ENGINE=InnoDB;
+/* GTID */ INSERT INTO t1 VALUES (11, 7, 0);
+/* GTID */ COMMIT;
+--let $before_drop_pos=query_get_value(SHOW MASTER STATUS, Position, 1)
+disconnect tmp_con;
+connection default;
+
+# We need to wait for the implicit DROP TEMPORARY TABLE to be logged after
+# tmp_con disconnect, otherwise we get sporadic test failures.
+--let $wait_condition= SELECT variable_value > $before_drop_pos FROM information_schema.global_status WHERE variable_name = 'binlog_snapshot_position'
+--source include/wait_condition.inc
+
+--let $binlog_pos2=query_get_value(SHOW MASTER STATUS, Position, 1)
+
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+FLUSH LOGS;
+
+--let $MYSQLD_DATADIR= `select @@datadir`
+--let $file= $MYSQLTEST_VARDIR/tmp/binlog_parallel_replication_marks.out
+--let OUTPUT_FILE=$file
+exec $MYSQL_BINLOG --start_position=$binlog_pos1 --stop_position=$binlog_pos2 $MYSQLD_DATADIR/$binlog_file > $file;
+
+perl;
+my $file= $ENV{'OUTPUT_FILE'};
+open F, "<", $file
+ or die "Unable to open file '$file': $!\n";
+while (<F>) {
+ s/^#\d+ +\d+:\d+:\d+ /# /;
+ s/GTID \d+-\d+-\d+/GTID #-#-#/;
+ s/end_log_pos \d+/end_log_pos #/;
+ s/table id \d+/table id #/;
+ s/mapped to number \d+/mapped to number #/;
+ s/CRC32 0x[0-9a-f]+/CRC32 0x########/;
+ print if /GTID|BEGIN|COMMIT|Table_map|Write_rows|Update_rows|Delete_rows|generated by server|40005 TEMPORARY/;
+}
+close F;
+EOF
+
+DROP TABLE t1;