| 1 |
--source include/not_group_replication_plugin.inc |
| 2 |
--source include/master-slave.inc |
| 3 |
|
| 4 |
# |
| 5 |
# BUG#16621582: REPLICATION FAILS WITH ERROR 1837 WHEN DOING MULTI-TABLE UPDATES WITH SAVEPOINTS |
| 6 |
# |
| 7 |
|
| 8 |
--source include/rpl_connection_slave.inc |
| 9 |
--source include/gtid_utils.inc |
| 10 |
--source include/rpl_connection_master.inc |
| 11 |
|
| 12 |
--source include/rpl_reset.inc |
| 13 |
|
| 14 |
--let $server_uuid= SELECT @@server_uuid |
| 15 |
|
| 16 |
CREATE TABLE t1(c1 int) ENGINE=InnoDB; |
| 17 |
CREATE TABLE t2(c1 int) ENGINE=InnoDB; |
| 18 |
|
| 19 |
# |
| 20 |
# Test #1: assert that on multi-table updates the tables are |
| 21 |
# marked correctly, even if no table is updated at |
| 22 |
# all |
| 23 |
# |
| 24 |
|
| 25 |
|
| 26 |
--source include/sync_slave_sql_with_master.inc |
| 27 |
|
| 28 |
# needed for the assert below |
| 29 |
--let $saved_gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED` |
| 30 |
|
| 31 |
--source include/rpl_connection_master.inc |
| 32 |
|
| 33 |
START TRANSACTION; |
| 34 |
UPDATE t1,t2 SET t1.c1 = 0; |
| 35 |
SAVEPOINT sp1; |
| 36 |
UPDATE t1,t2 SET t1.c1 = 0; |
| 37 |
SAVEPOINT sp2; |
| 38 |
COMMIT; |
| 39 |
|
| 40 |
--source include/sync_slave_sql_with_master.inc |
| 41 |
|
| 42 |
# assert that we have 1 more transaction in STMT or MIXED |
| 43 |
# or no additional transaction at all in RBR |
| 44 |
--let $current_gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED` |
| 45 |
--let $saved_gtid_cnt= `SELECT GTID_COUNT('$saved_gtid_executed')` |
| 46 |
--let $current_gtid_cnt= `SELECT GTID_COUNT('$current_gtid_executed')` |
| 47 |
if (`SELECT @@binlog_format = 'row'`) |
| 48 |
{ |
| 49 |
# nothing was logged in RBR |
| 50 |
--let $expected_gtid_cnt= $saved_gtid_cnt |
| 51 |
} |
| 52 |
if (`SELECT @@binlog_format <> 'row'`) |
| 53 |
{ |
| 54 |
--let $expected_gtid_cnt= `SELECT $saved_gtid_cnt + 1` |
| 55 |
} |
| 56 |
|
| 57 |
--let $assert_cond= $current_gtid_cnt = $expected_gtid_cnt |
| 58 |
--let $assert_text= The correct count of transactions is expected on the slave |
| 59 |
--source include/assert.inc |
| 60 |
|
| 61 |
--source include/rpl_connection_master.inc |
| 62 |
|
| 63 |
# |
| 64 |
# Test #2: assert that on multi-table updates the tables are |
| 65 |
# marked correctly, even if the table is updated on |
| 66 |
# the fly |
| 67 |
# |
| 68 |
|
| 69 |
INSERT INTO t1 VALUES (1); |
| 70 |
INSERT INTO t2 VALUES (2); |
| 71 |
|
| 72 |
--source include/sync_slave_sql_with_master.inc |
| 73 |
|
| 74 |
# needed for the assert below |
| 75 |
--let $saved_gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED` |
| 76 |
|
| 77 |
--source include/rpl_connection_master.inc |
| 78 |
|
| 79 |
START TRANSACTION; |
| 80 |
UPDATE t1,t2 SET t1.c1 = 0; |
| 81 |
COMMIT; |
| 82 |
|
| 83 |
--source include/sync_slave_sql_with_master.inc |
| 84 |
|
| 85 |
# assert that we have 1 more transaction in STMT or MIXED |
| 86 |
# or no additional transaction at all in RBR |
| 87 |
--let $current_gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED` |
| 88 |
--let $saved_gtid_cnt= `SELECT GTID_COUNT('$saved_gtid_executed')` |
| 89 |
--let $current_gtid_cnt= `SELECT GTID_COUNT('$current_gtid_executed')` |
| 90 |
--let $expected_gtid_cnt= `SELECT $saved_gtid_cnt + 1` |
| 91 |
|
| 92 |
--let $assert_cond= $current_gtid_cnt = $expected_gtid_cnt |
| 93 |
--let $assert_text= The correct count of transactions is expected on the slave |
| 94 |
--source include/assert.inc |
| 95 |
|
| 96 |
--source include/rpl_connection_master.inc |
| 97 |
|
| 98 |
DROP TABLE t1; |
| 99 |
DROP TABLE t2; |
| 100 |
|
| 101 |
--source include/sync_slave_sql_with_master.inc |
| 102 |
--source include/gtid_utils_end.inc |
| 103 |
--source include/rpl_connection_master.inc |
| 104 |
|
| 105 |
--source include/rpl_end.inc |