| 1 |
################################################################################ |
| 2 |
# Test case to verify that concurrent transactions with intersecting |
| 3 |
# write set, the same primary key invisible column, do conflict. |
| 4 |
# |
| 5 |
# T1: WS={t1.c1= 1} |
| 6 |
# T2: WS={t1.c2= 1} |
| 7 |
# |
| 8 |
# Outcome: T1 must abort, T2 must commit. |
| 9 |
# |
| 10 |
# Test: |
| 11 |
# 0. The test requires two servers: M1 and M2. |
| 12 |
# 1. With both members ONLINE. Create a table on M1. |
| 13 |
# 2. Checking the negative case in which there is a conflict. |
| 14 |
# 3. Checking the positive case in which there is no conflict: |
| 15 |
# 4. Assert servers consistency. |
| 16 |
# 5. Clean up. |
| 17 |
################################################################################ |
| 18 |
--source include/have_debug_sync.inc |
| 19 |
--source include/have_group_replication_plugin.inc |
| 20 |
--source include/group_replication.inc |
| 21 |
|
| 22 |
|
| 23 |
--echo |
| 24 |
--echo # 1. With both members ONLINE. Create a table on M1. |
| 25 |
--echo |
| 26 |
--let $rpl_connection_name= server1 |
| 27 |
--source include/rpl_connection.inc |
| 28 |
|
| 29 |
CREATE TABLE t1 (c1 INT PRIMARY KEY INVISIBLE, c2 INT); |
| 30 |
|
| 31 |
SELECT * FROM t1; |
| 32 |
|
| 33 |
SELECT c1, c2 FROM t1; |
| 34 |
|
| 35 |
--source include/rpl_sync.inc |
| 36 |
|
| 37 |
|
| 38 |
--echo |
| 39 |
--echo # 2. Checking the negative case in which there is a conflict. |
| 40 |
--echo |
| 41 |
--let $local_server_connection1=server1 |
| 42 |
--let $local_server_connection2=server_1 |
| 43 |
--let $remote_server_connection=server2 |
| 44 |
--let $local_transaction= INSERT INTO t1 (c1, c2) VALUES (1, 10) |
| 45 |
--let $remote_transaction= INSERT INTO t1 (c1, c2) VALUES (1, 20) |
| 46 |
--let $conflict_test=1 |
| 47 |
--source include/gr_parallel_local_and_remote_transactions.inc |
| 48 |
|
| 49 |
|
| 50 |
--echo |
| 51 |
--echo # 3. Checking the positive case in which there is no conflict. |
| 52 |
--echo |
| 53 |
--let $local_server_connection1=server1 |
| 54 |
--let $local_server_connection2=server_1 |
| 55 |
--let $remote_server_connection=server2 |
| 56 |
--let $local_transaction= INSERT INTO t1 (c1, c2) VALUES (2, 10) |
| 57 |
--let $remote_transaction= INSERT INTO t1 (c1, c2) VALUES (3, 20) |
| 58 |
--let $conflict_test=0 |
| 59 |
--source include/gr_parallel_local_and_remote_transactions.inc |
| 60 |
|
| 61 |
|
| 62 |
--echo |
| 63 |
--echo # 4. Assert servers consistency. |
| 64 |
--echo |
| 65 |
--let $rpl_connection_name= server1 |
| 66 |
--source include/rpl_connection.inc |
| 67 |
|
| 68 |
--let $assert_text= Table t1 will contain row after the above execution |
| 69 |
--let $assert_cond= "[SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1]" = "1" |
| 70 |
--source include/assert.inc |
| 71 |
|
| 72 |
--let $assert_text= Table t1 will contain row after the above execution |
| 73 |
--let $assert_cond= "[SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 2, count, 1]" = "1" |
| 74 |
--source include/assert.inc |
| 75 |
|
| 76 |
--let $assert_text= Table t1 will contain row after the above execution |
| 77 |
--let $assert_cond= "[SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 3, count, 1]" = "1" |
| 78 |
--source include/assert.inc |
| 79 |
|
| 80 |
--let $assert_text= Table t1 will contain 3 rows after the above execution |
| 81 |
--let $assert_cond= "[SELECT COUNT(*) FROM t1]" = "3" |
| 82 |
--source include/assert.inc |
| 83 |
|
| 84 |
|
| 85 |
--echo |
| 86 |
--echo # 5. Clean up. |
| 87 |
--echo |
| 88 |
DROP TABLE t1; |
| 89 |
|
| 90 |
--source include/group_replication_end.inc |