| 1 |
################################################################################ |
| 2 |
# Validate that conflicts between transactions with huge number of changed rows |
| 3 |
# are detected. |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. The test requires two servers: M1 and M2. |
| 7 |
# 1. Create a table on server1 and insert 71000 rows on it. |
| 8 |
# 2. Assert that a conflict between a huge transaction, one that |
| 9 |
# does change all table rows, and a small transaction is |
| 10 |
# detected. |
| 11 |
# 3. Assert that the remote transaction was the applied on both |
| 12 |
# members. |
| 13 |
# 4. Clean up. |
| 14 |
################################################################################ |
| 15 |
--source include/not_valgrind.inc |
| 16 |
--source include/big_test.inc |
| 17 |
--source include/have_debug_sync.inc |
| 18 |
--source include/have_group_replication_plugin.inc |
| 19 |
--source include/group_replication.inc |
| 20 |
|
| 21 |
|
| 22 |
--echo |
| 23 |
--echo ############################################################ |
| 24 |
--echo # Create a table on server1 and insert 71000 rows on it. |
| 25 |
--let $rpl_connection_name= server1 |
| 26 |
--source include/rpl_connection.inc |
| 27 |
CREATE TABLE t1(id INT PRIMARY KEY, balance INT); |
| 28 |
|
| 29 |
--let $trx= 71000 |
| 30 |
--disable_query_log |
| 31 |
BEGIN; |
| 32 |
while($trx) |
| 33 |
{ |
| 34 |
--eval INSERT INTO t1 VALUES($trx, 0) |
| 35 |
--dec $trx |
| 36 |
} |
| 37 |
COMMIT; |
| 38 |
--enable_query_log |
| 39 |
--let $slave_timeout= 1800 |
| 40 |
--source include/rpl_sync.inc |
| 41 |
|
| 42 |
|
| 43 |
--echo |
| 44 |
--echo ############################################################ |
| 45 |
--echo # Assert that a conflict between a huge transaction, one that |
| 46 |
--echo # does change all table rows, and a small transaction is |
| 47 |
--echo # detected. |
| 48 |
--let $local_server_connection1=server1 |
| 49 |
--let $local_server_connection2=server_1 |
| 50 |
--let $remote_server_connection=server2 |
| 51 |
--let $local_transaction=UPDATE t1 SET balance=1000 |
| 52 |
--let $remote_transaction=UPDATE t1 SET balance=200 WHERE id>70000 AND id<70100 |
| 53 |
--let $conflict_test=1 |
| 54 |
--source include/gr_parallel_local_and_remote_transactions.inc |
| 55 |
|
| 56 |
|
| 57 |
--echo |
| 58 |
--echo ############################################################ |
| 59 |
--echo # Assert that the remote transaction was the applied on both |
| 60 |
--echo # members. |
| 61 |
--let $rpl_connection_name= server1 |
| 62 |
--source include/rpl_connection.inc |
| 63 |
|
| 64 |
--let $assert_text= 'There are 0 rows with value 1000 in table t1' |
| 65 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.balance=1000, count, 1] = 0 |
| 66 |
--source include/assert.inc |
| 67 |
|
| 68 |
--let $assert_text= 'There are 70901 rows with value 0 in table t1' |
| 69 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.balance=0 AND (id<=70000 OR id>=70100), count, 1] = 70901 |
| 70 |
--source include/assert.inc |
| 71 |
|
| 72 |
--let $assert_text= 'There are 99 rows with value 200 in table t1' |
| 73 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.balance=200 AND id>70000 AND id<70100, count, 1] = 99 |
| 74 |
--source include/assert.inc |
| 75 |
|
| 76 |
--let $diff_tables= server1:test.t1, server2:test.t1 |
| 77 |
--source include/diff_tables.inc |
| 78 |
|
| 79 |
|
| 80 |
--echo |
| 81 |
--echo ############################################################ |
| 82 |
--echo # Clean up. |
| 83 |
DROP TABLE t1; |
| 84 |
|
| 85 |
--source include/group_replication_end.inc |