| 1 |
################################################################################ |
| 2 |
# Scenario: |
| 3 |
# SigCon= ({R(B), W(B)}) |
| 4 |
# GroupRepApplier=({R(B), W(B), C}, HIGH_PRIORITY). |
| 5 |
# |
| 6 |
# Outcome: SigCon must abort, THe GroupRepApplier must commit. |
| 7 |
# |
| 8 |
# Full details on WL#6835. |
| 9 |
# |
| 10 |
# Test: |
| 11 |
# 0. The test requires two servers: M1 and M2. |
| 12 |
# 1. With both members ONLINE. On M1 create table t1 and insert value 0 in |
| 13 |
# column c1. |
| 14 |
# 2. On M2, create SIGCON connection using DEBUG point. |
| 15 |
# 3. On M2, send update c1 from 0 to 99. |
| 16 |
# 4. On M1, update c1 from 0 to 1. |
| 17 |
# 5. On M2, wait for c1 to be 1. |
| 18 |
# 6. On M2, now signal the waiting thread on sigcon to resume and it should |
| 19 |
# end up in an error stating that it was aborted. |
| 20 |
# 7. On M2, reap. It should error out on COMMIT. |
| 21 |
# 8. Validate data in c1. It should be 1 on M2. |
| 22 |
# 9. Clean up. |
| 23 |
################################################################################ |
| 24 |
|
| 25 |
--source include/have_debug.inc |
| 26 |
--source include/have_debug_sync.inc |
| 27 |
--let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9429548 |
| 28 |
--source include/have_group_replication_plugin.inc |
| 29 |
|
| 30 |
--source include/group_replication.inc |
| 31 |
|
| 32 |
####### SERVER 1 ####### |
| 33 |
--let $rpl_connection_name= server1 |
| 34 |
--source include/rpl_connection.inc |
| 35 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 36 |
INSERT INTO t1 VALUES (0); |
| 37 |
|
| 38 |
####### SIGCON (server2) ####### |
| 39 |
--let $rpl_connection_name= sigcon |
| 40 |
--let $rpl_server_number= 2 |
| 41 |
--source include/rpl_connect.inc |
| 42 |
|
| 43 |
--echo [connection sigcon] |
| 44 |
--let $sync_slave_connection= sigcon |
| 45 |
--source include/sync_slave_sql_with_master.inc |
| 46 |
|
| 47 |
SET DEBUG_SYNC='ha_innobase_end_statement WAIT_FOR waiting1'; |
| 48 |
|
| 49 |
BEGIN; |
| 50 |
--send UPDATE t1 SET c1=99 WHERE c1=0 |
| 51 |
|
| 52 |
####### SERVER 2 ####### |
| 53 |
--let $rpl_connection_name= server2 |
| 54 |
--source include/rpl_connection.inc |
| 55 |
# Wait until sigcon reaches the ha_innobase_update_row_done debug sync point. |
| 56 |
--let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: ha_innobase_end_statement' |
| 57 |
--source include/wait_condition.inc |
| 58 |
|
| 59 |
####### SERVER 1 ####### |
| 60 |
--let $rpl_connection_name= server1 |
| 61 |
--source include/rpl_connection.inc |
| 62 |
UPDATE t1 SET c1=1 WHERE c1=0; |
| 63 |
|
| 64 |
####### SERVER 2 ####### |
| 65 |
--let $rpl_connection_name= server2 |
| 66 |
--source include/rpl_connection.inc |
| 67 |
|
| 68 |
# Wait for c1 in t1 to be 1 |
| 69 |
--let $wait_condition=SELECT COUNT(*)=1 FROM t1 WHERE c1=1 |
| 70 |
--source include/wait_condition.inc |
| 71 |
|
| 72 |
# Now signal the waiting thread on sigcon to resume |
| 73 |
# and it should end up in an error stating that it |
| 74 |
# was aborted |
| 75 |
SET DEBUG_SYNC='now SIGNAL waiting1'; |
| 76 |
|
| 77 |
####### SIGCON ####### |
| 78 |
--echo [connection sigcon] |
| 79 |
--let $rpl_connection_name= sigcon |
| 80 |
--source include/rpl_connection.inc |
| 81 |
--reap |
| 82 |
--error ER_ERROR_DURING_COMMIT |
| 83 |
COMMIT; |
| 84 |
|
| 85 |
--disconnect sigcon |
| 86 |
|
| 87 |
####### SERVER 2 ####### |
| 88 |
--connection server1 |
| 89 |
--let $sync_slave_connection= server2 |
| 90 |
--source include/sync_slave_sql_with_master.inc |
| 91 |
|
| 92 |
--let $assert_text= 'There is a 1 in t1' |
| 93 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1 |
| 94 |
--source include/assert.inc |
| 95 |
|
| 96 |
--let $assert_text= 'There is no 0 in t1' |
| 97 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 0, count, 1] = 0 |
| 98 |
--source include/assert.inc |
| 99 |
|
| 100 |
--let $assert_text= 'There is no 99 in t1' |
| 101 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 99, count, 1] = 0 |
| 102 |
--source include/assert.inc |
| 103 |
|
| 104 |
# Clean up. |
| 105 |
--connection server1 |
| 106 |
DROP TABLE t1; |
| 107 |
|
| 108 |
--source include/group_replication_end.inc |