| 1 |
# |
| 2 |
# The test verifies proper computation of logical timestamps in |
| 3 |
# few situations having GTID mode OFF. |
| 4 |
# |
| 5 |
--source include/have_binlog_format_mixed.inc |
| 6 |
--source include/force_myisam_default.inc |
| 7 |
--source include/have_myisam.inc |
| 8 |
|
| 9 |
|
| 10 |
# |
| 11 |
# Tests that are independent of GTID_MODE |
| 12 |
# |
| 13 |
--source extra/binlog_tests/logical_timestamping.inc |
| 14 |
|
| 15 |
|
| 16 |
# |
| 17 |
# Tests that require GTID_MODE=OFF follow. |
| 18 |
# |
| 19 |
# Testing the mixed engine transaction logging. |
| 20 |
# There must be two groups per transaction in the binary log. Each group |
| 21 |
# is tagged with own sequence_number. |
| 22 |
# |
| 23 |
|
| 24 |
CALL mtr.add_suppression("Some non-transactional changed tables couldn't be rolled back"); |
| 25 |
CREATE TABLE t1 (a int) ENGINE= innodb; |
| 26 |
CREATE TABLE tm (a int) ENGINE= MyISAM; |
| 27 |
|
| 28 |
--delimiter | |
| 29 |
CREATE PROCEDURE p1 () |
| 30 |
BEGIN |
| 31 |
START TRANSACTION; |
| 32 |
INSERT INTO t1 SET a=1; |
| 33 |
INSERT INTO tm SET a=2; |
| 34 |
COMMIT; |
| 35 |
START TRANSACTION; |
| 36 |
INSERT INTO t1 SET a=1; |
| 37 |
INSERT INTO tm SET a=2; |
| 38 |
ROLLBACK; |
| 39 |
END| |
| 40 |
# multiple reqular transactions |
| 41 |
CREATE PROCEDURE p2 () |
| 42 |
BEGIN |
| 43 |
START TRANSACTION; |
| 44 |
INSERT INTO t1 SET a=1; |
| 45 |
COMMIT; |
| 46 |
START TRANSACTION; |
| 47 |
INSERT INTO t1 SET a=2; |
| 48 |
COMMIT; |
| 49 |
START TRANSACTION; |
| 50 |
INSERT INTO t1 SET a=3; |
| 51 |
COMMIT; |
| 52 |
END| |
| 53 |
--delimiter ; |
| 54 |
|
| 55 |
# Now the proof: the mixed transactions are logged as two parts. |
| 56 |
# In case of ROLLBACK the transactional engine part is gone. |
| 57 |
# p1() produces two groups, p2() one, and p3() three. |
| 58 |
|
| 59 |
RESET MASTER; |
| 60 |
# transaction that mixes transactional and nontransactional tables and commits |
| 61 |
START TRANSACTION; |
| 62 |
INSERT INTO t1 SET a=1; |
| 63 |
INSERT INTO tm SET a=2; |
| 64 |
COMMIT; |
| 65 |
--let $binlog_file= binlog.000001 |
| 66 |
--let $logical_timestamps= 0 1;1 2 |
| 67 |
--source include/assert_logical_timestamps.inc |
| 68 |
|
| 69 |
RESET MASTER; |
| 70 |
# transaction that mixes transactional and nontransactional tables and rolls back |
| 71 |
START TRANSACTION; |
| 72 |
INSERT INTO t1 SET a=1; |
| 73 |
INSERT INTO tm SET a=2; |
| 74 |
ROLLBACK; |
| 75 |
|
| 76 |
--let $logical_timestamps= 0 1 |
| 77 |
--source include/assert_logical_timestamps.inc |
| 78 |
|
| 79 |
RESET MASTER; |
| 80 |
# One query gets logged to as multiple transactions, due to both mixed |
| 81 |
# engines and multiple transactions executed by a stored procedure. |
| 82 |
|
| 83 |
CALL p1(); |
| 84 |
|
| 85 |
--let $logical_timestamps= 0 1;1 2;2 3 |
| 86 |
--source include/assert_logical_timestamps.inc |
| 87 |
|
| 88 |
RESET MASTER; |
| 89 |
# few regular transactions logged with one query |
| 90 |
CALL p2(); |
| 91 |
|
| 92 |
--let $logical_timestamps= 0 1;1 2;2 3 |
| 93 |
--source include/assert_logical_timestamps.inc |
| 94 |
|
| 95 |
DROP PROCEDURE p1; |
| 96 |
DROP PROCEDURE p2; |
| 97 |
DROP TABLE tm,t1; |