| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# This test will generate many workloads and will assert that the rbr_only |
| 4 |
# flags in binary log are "yes" only for transactions containing only RBR |
| 5 |
# DML transactions. |
| 6 |
# |
| 7 |
# ==== Related Bugs and Worklogs ==== |
| 8 |
# |
| 9 |
# BUG#25040331 INTERLEAVED XA TRANSACTIONS MAY DEADLOCK SLAVE APPLIER WITH |
| 10 |
# REPEATABLE READ |
| 11 |
# |
| 12 |
|
| 13 |
# This test case requires MIXED binary log format |
| 14 |
--source include/have_binlog_format_mixed.inc |
| 15 |
|
| 16 |
# This DDL will not be evaluated by the assert |
| 17 |
CREATE TABLE log ( |
| 18 |
c1 INT AUTO_INCREMENT PRIMARY KEY, |
| 19 |
c2 TEXT, |
| 20 |
c3 INT NOT NULL DEFAULT 0); |
| 21 |
|
| 22 |
RESET MASTER; |
| 23 |
--let $server_uuid= `SELECT @@server_uuid` |
| 24 |
|
| 25 |
--echo # 1 - Empty transaction |
| 26 |
--replace_result $server_uuid SERVER_UUID |
| 27 |
--eval SET GTID_NEXT='$server_uuid:1' |
| 28 |
BEGIN; |
| 29 |
COMMIT; |
| 30 |
SET GTID_NEXT=AUTOMATIC; |
| 31 |
|
| 32 |
# Empty XA transaction are not binary logged |
| 33 |
|
| 34 |
--echo # 2 and 3 - XA SBR + XA COMMIT |
| 35 |
XA START 'a'; |
| 36 |
INSERT INTO log (c2) VALUES ('XA COMMIT'); |
| 37 |
XA END 'a'; |
| 38 |
XA PREPARE 'a'; |
| 39 |
XA COMMIT 'a'; |
| 40 |
|
| 41 |
--echo # 4 and 5 - XA SBR + XA ROLLBACK |
| 42 |
XA START 'b'; |
| 43 |
INSERT INTO log (c2) VALUES ('XA ROLLBACK'); |
| 44 |
XA END 'b'; |
| 45 |
XA PREPARE 'b'; |
| 46 |
XA ROLLBACK 'b'; |
| 47 |
|
| 48 |
--echo # 6 - Atomic DDL |
| 49 |
CREATE TABLE t1 (c1 INT); |
| 50 |
|
| 51 |
--echo # 7 - non-atomic DDL |
| 52 |
CREATE TABLE t2 (c1 INT); |
| 53 |
|
| 54 |
--echo # 8 - SBR only DML transaction |
| 55 |
BEGIN; |
| 56 |
INSERT INTO log (c2) VALUES ('SBR only DML transaction'); |
| 57 |
COMMIT; |
| 58 |
|
| 59 |
--echo # 9 - SBR and RBR DML transaction |
| 60 |
BEGIN; |
| 61 |
INSERT INTO log (c2) VALUES ('SBR and RBR DML transaction'); |
| 62 |
INSERT INTO log (c2, c3) VALUES ('SBR and RBR DML transaction', RAND()*100); |
| 63 |
COMMIT; |
| 64 |
|
| 65 |
--echo # 10 - RBR only DML transaction |
| 66 |
BEGIN; |
| 67 |
INSERT INTO log (c2, c3) VALUES ('RBR only DML transaction', RAND()*100); |
| 68 |
COMMIT; |
| 69 |
|
| 70 |
--echo # 11 - RBR only DML transaction with SAVEPOINT |
| 71 |
BEGIN; |
| 72 |
INSERT INTO log (c2, c3) VALUES ('RBR only DML transaction with SAVEPOINT', RAND()*100); |
| 73 |
SAVEPOINT `a`; |
| 74 |
INSERT INTO log (c2, c3) VALUES ('RBR only DML transaction with SAVEPOINT', RAND()*100); |
| 75 |
SAVEPOINT `b`; |
| 76 |
INSERT INTO log (c2, c3) VALUES ('RBR only DML transaction with SAVEPOINT', RAND()*100); |
| 77 |
COMMIT; |
| 78 |
|
| 79 |
--echo # 12 - RBR only DML with rows query info |
| 80 |
SET @@SESSION.binlog_rows_query_log_events = ON; |
| 81 |
BEGIN; |
| 82 |
INSERT INTO log (c2, c3) VALUES ('DML with rows query info', RAND()*100); |
| 83 |
COMMIT; |
| 84 |
SET @@SESSION.binlog_rows_query_log_events = OFF; |
| 85 |
|
| 86 |
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 87 |
# 1 2 3 4 5 6 7 8 9 10 11 12 |
| 88 |
--let $rbr_only_flags= no,yes,no,yes,no,no,no,no,no,yes,yes,yes |
| 89 |
--source include/assert_rbr_only_flags.inc |
| 90 |
|
| 91 |
# Cleanup |
| 92 |
DROP TABLE t1, t2, log; |