|
| 1 | +include/only_with_option.inc [GLOBAL.replica_parallel_workers > 1] |
| 2 | +include/group_replication.inc [rpl_server_count=4] |
| 3 | +Warnings: |
| 4 | +Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 5 | +Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. |
| 6 | +[connection server1] |
| 7 | +# Bootstrap group with server1 as primary and server2, server3 as secondaries. |
| 8 | +[connection server1] |
| 9 | +include/start_and_bootstrap_group_replication.inc |
| 10 | +# Create inbound channel from server4 to server1 |
| 11 | +CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_AUTO_POSITION=1, SOURCE_PORT=SERVER_4_PORT FOR CHANNEL 'ch1'; |
| 12 | +Warnings: |
| 13 | +Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 14 | +Note 1760 Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. |
| 15 | +include/rpl/start_replica.inc [FOR CHANNEL 'ch1'] |
| 16 | +# Suppress errors |
| 17 | +include/suppress_messages.inc |
| 18 | +# Connection 1 suppresses message <Replica SQL for channel 'ch1': Worker .* failed executing transaction '.*' at source log .* Could not execute Write_rows event on table test.t1>. |
| 19 | +# Connection 1 suppresses message <Replica SQL for channel 'ch1': ... The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state.>. |
| 20 | +# Connection 1 suppresses message <Plugin group_replication reported: 'The requested GTID '.*' was already used, the transaction will rollback.*'>. |
| 21 | +# Connection 2 suppresses message <Replica SQL for channel 'ch1': Worker .* failed executing transaction '.*' at source log .* Could not execute Write_rows event on table test.t1>. |
| 22 | +# Connection 2 suppresses message <Replica SQL for channel 'ch1': ... The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state.>. |
| 23 | +# Connection 2 suppresses message <Plugin group_replication reported: 'The requested GTID '.*' was already used, the transaction will rollback.*'>. |
| 24 | +# Connection 3 suppresses message <Replica SQL for channel 'ch1': Worker .* failed executing transaction '.*' at source log .* Could not execute Write_rows event on table test.t1>. |
| 25 | +# Connection 3 suppresses message <Replica SQL for channel 'ch1': ... The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state.>. |
| 26 | +# Connection 3 suppresses message <Plugin group_replication reported: 'The requested GTID '.*' was already used, the transaction will rollback.*'>. |
| 27 | +# Connection 4 suppresses message <Replica SQL for channel 'ch1': Worker .* failed executing transaction '.*' at source log .* Could not execute Write_rows event on table test.t1>. |
| 28 | +# Connection 4 suppresses message <Replica SQL for channel 'ch1': ... The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state.>. |
| 29 | +# Connection 4 suppresses message <Plugin group_replication reported: 'The requested GTID '.*' was already used, the transaction will rollback.*'>. |
| 30 | +# Create table |
| 31 | +[connection server4] |
| 32 | +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY); |
| 33 | +include/rpl/sync_to_replica.inc |
| 34 | +# Make server2 join the group |
| 35 | +[connection server2] |
| 36 | +include/start_group_replication.inc |
| 37 | +# Begin a transasction on the group primary so that T1 will be blocked |
| 38 | +[connection server_1_1] |
| 39 | +BEGIN; |
| 40 | +INSERT INTO t1 VALUES (1); |
| 41 | +# Begin a transasction on the group primary so that T3 will be blocked |
| 42 | +[connection server_1_2] |
| 43 | +BEGIN; |
| 44 | +INSERT INTO t1 VALUES (3); |
| 45 | +# Commit transactions T1, T2, T3 on the upstream source. |
| 46 | +# This should eventually lead to the following state on the group primary: |
| 47 | +# T1: blocked by local session |
| 48 | +# T2: certified, waiting for preceding transaction to commit |
| 49 | +# T3: blocked by local session |
| 50 | +[connection server4] |
| 51 | +INSERT INTO t1 VALUES (1); |
| 52 | +INSERT INTO t1 VALUES (2); |
| 53 | +INSERT INTO t1 VALUES (3); |
| 54 | +# Wait until T2 is waiting for T1 to commit. |
| 55 | +[connection server1] |
| 56 | +include/save_error_log_position.inc |
| 57 | +# Join server3 to the group |
| 58 | +# The join will produce a view_change, delivered after T2. |
| 59 | +# This forces T2 to bypass replica-preserve-commit-order and commit before T1. |
| 60 | +# This should eventually lead to the following state on the group primary: |
| 61 | +# T1: blocked by local session |
| 62 | +# T2: committed ahead |
| 63 | +# T3: blocked by local session |
| 64 | +[connection server3] |
| 65 | +include/start_group_replication.inc |
| 66 | +# Wait for T2 to commit on server1. |
| 67 | +[connection server1] |
| 68 | +include/assert_error_log.inc [server: 1, pattern: The transaction '[a-z0-9\-]*:[0-9]*' will commit out of order with respect to its source to follow the group global order] |
| 69 | +# Verify that T1, T3 are still not committed |
| 70 | +include/assert.inc [There should be two missing GTIDs] |
| 71 | +# Check that *new* transactions block as needed, *not* violating replica-preserve-commit-order. |
| 72 | +# This should eventually lead to the following state on the group primary: |
| 73 | +# T1: blocked by local session |
| 74 | +# T2: committed ahead |
| 75 | +# T3: blocked by local session |
| 76 | +# T4: waiting for preceding transaction (T3) |
| 77 | +[connection server_4] |
| 78 | +INSERT INTO t1 VALUES (4); |
| 79 | +[connection server_1] |
| 80 | +# Wait until T4 is waiting for preceding transaction to commit. |
| 81 | +include/assert.inc [t1 should still have only one element] |
| 82 | +# Unblock T3. |
| 83 | +# This should eventually lead to the following state on the group primary: |
| 84 | +# T1: blocked by local session |
| 85 | +# T2: committed ahead |
| 86 | +# T3: waiting for preceding transaction (T1) |
| 87 | +# T4: waiting for preceding transaction (T3) |
| 88 | +[connection server_1_2] |
| 89 | +ROLLBACK; |
| 90 | +# Wait until T3 is waiting for preceding transaction to commit. |
| 91 | +# Make T1 fail, by committing the blocking transaction. |
| 92 | +# This should eventually lead to the following state on the group primary: |
| 93 | +# T1: rolled back |
| 94 | +# T2: committed ahead |
| 95 | +# T3: rolled back |
| 96 | +# T4: rolled back |
| 97 | +[connection server_1_1] |
| 98 | +COMMIT; |
| 99 | +include/rpl/wait_for_applier_error.inc [errno=1062 FOR CHANNEL 'ch1'] |
| 100 | +include/assert.inc [There should be 3 missing GTIDs] |
| 101 | +include/assert.inc [t1 should have two elements (one replicated, one from local session)] |
| 102 | +# Remove the duplicate row on the group primary. |
| 103 | +[connection server1] |
| 104 | +DELETE FROM t1 WHERE c1 = 1; |
| 105 | +# Start the inbound channel again. |
| 106 | +# Now that the duplicate row is gone, it should be able to replicate T1, T3, T4. |
| 107 | +# This should eventually lead to the following state on the group primary: |
| 108 | +# T1: committed |
| 109 | +# T2: committed ahead |
| 110 | +# T3: committed |
| 111 | +# T4: committed |
| 112 | +include/rpl/start_replica.inc [FOR CHANNEL 'ch1'] |
| 113 | +[connection server4] |
| 114 | +include/rpl/sync_to_replica.inc |
| 115 | +include/rpl/sync.inc |
| 116 | +# Clean up |
| 117 | +[connection server4] |
| 118 | +DROP TABLE t1; |
| 119 | +include/rpl/sync_to_replica.inc |
| 120 | +include/rpl/sync.inc |
| 121 | +[connection server1] |
| 122 | +include/rpl/stop_replica.inc [FOR CHANNEL 'ch1'] |
| 123 | +RESET REPLICA ALL FOR CHANNEL 'ch1'; |
| 124 | +include/group_replication_end.inc |
0 commit comments