|
| 1 | +include/group_replication.inc |
| 2 | +Warnings: |
| 3 | +Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 4 | +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. |
| 5 | +[connection server1] |
| 6 | + |
| 7 | +############################################################ |
| 8 | +# 1. Create a table on server1. |
| 9 | +[connection server1] |
| 10 | +CREATE TABLE t1(a VARCHAR(64), b VARCHAR(64), PRIMARY KEY(a(4), b)); |
| 11 | +include/rpl_sync.inc |
| 12 | + |
| 13 | +############################################################ |
| 14 | +# 2. Set a debug sync before broadcast message to group on |
| 15 | +# connection server_1. |
| 16 | +# Commit a transaction that will be block before broadcast. |
| 17 | +[connection server_1] |
| 18 | +SET @debug_save= @@GLOBAL.DEBUG; |
| 19 | +SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast'; |
| 20 | +BEGIN; |
| 21 | +INSERT INTO t1 VALUE('aaaaxxxx', 'bbbbxxxx'); |
| 22 | +COMMIT; |
| 23 | + |
| 24 | +############################################################ |
| 25 | +# 3. Wait until server_1 connection reaches the |
| 26 | +# group_replication_before_message_broadcast debug sync point. |
| 27 | +[connection server1] |
| 28 | + |
| 29 | +############################################################ |
| 30 | +# 4. Execute a transaction on server2, that will reach first |
| 31 | +# certification, since server_1 is blocked before broadcast. |
| 32 | +# Set do_not_add_pke_key_part debug so that server adds |
| 33 | +# only not truncated PKE. See Bug#35404584. |
| 34 | +[connection server2] |
| 35 | +SET @debug_save2= @@GLOBAL.DEBUG; |
| 36 | +SET @@GLOBAL.DEBUG= 'd,do_not_add_pke_key_part'; |
| 37 | +INSERT INTO t1 VALUE('aaaaxxxx', 'bbbbxxxx'); |
| 38 | + |
| 39 | +############################################################ |
| 40 | +# 5. Signal the waiting thread on server_1 to resume. |
| 41 | +[connection server1] |
| 42 | +SET DEBUG_SYNC='now SIGNAL waiting'; |
| 43 | +SET @@GLOBAL.DEBUG= @debug_save; |
| 44 | + |
| 45 | +############################################################ |
| 46 | +# 6. It will end up in an error stating that it was aborted, |
| 47 | +# since transactions are conflicting and server2 was |
| 48 | +# ordered first. |
| 49 | +[connection server2] |
| 50 | +include/sync_slave_sql_with_master.inc |
| 51 | +[connection server_1] |
| 52 | +ERROR 40000: Plugin instructed the server to rollback the current transaction. |
| 53 | + |
| 54 | +############################################################ |
| 55 | +# 7. Assert that number of certified transactions are the |
| 56 | +# expected ones. |
| 57 | +[connection server1] |
| 58 | +include/assert.inc [The value of Count_Transactions_Checked should be 3 after starting group replication] |
| 59 | +include/assert.inc [The value of Count_Conflicts_Detected should be 1 after starting group replication] |
| 60 | + |
| 61 | +############################################################ |
| 62 | +# Checking the positive case in which there is no conflict. |
| 63 | +############################################################ |
| 64 | + |
| 65 | +############################################################ |
| 66 | +# 1. Set a debug sync before broadcast message to group on |
| 67 | +# connection server_1. |
| 68 | +# Commit a transaction that will be block before broadcast. |
| 69 | +[connection server_1] |
| 70 | +SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast'; |
| 71 | +BEGIN; |
| 72 | +INSERT INTO t1 VALUES ('ccccxxxx', 'bbbbxxxx'); |
| 73 | +COMMIT; |
| 74 | + |
| 75 | +############################################################ |
| 76 | +# 2. Wait until server_1 connection reaches the |
| 77 | +# group_replication_before_message_broadcast debug sync point. |
| 78 | +[connection server1] |
| 79 | + |
| 80 | +############################################################ |
| 81 | +# 3. Execute a transaction on server2, that will reach first |
| 82 | +# certification, since server_1 is blocked before broadcast. |
| 83 | +# Set do_not_add_pke_key_part debug so that server adds |
| 84 | +# only not truncated PKE. See Bug#35404584. |
| 85 | +[connection server2] |
| 86 | +INSERT INTO t1 VALUES ('ddddxxxx', 'bbbbxxxx'); |
| 87 | +include/sync_slave_sql_with_master.inc |
| 88 | + |
| 89 | +############################################################ |
| 90 | +# 4. Signal the waiting thread on server_1 to resume. |
| 91 | +[connection server1] |
| 92 | +SET DEBUG_SYNC='now SIGNAL waiting'; |
| 93 | +SET @@GLOBAL.DEBUG= @debug_save; |
| 94 | + |
| 95 | +######################################################################## |
| 96 | +# 5. It will execute without error as the conflicting transactions have |
| 97 | +# been removed. |
| 98 | +[connection server_1] |
| 99 | +include/rpl_sync.inc |
| 100 | + |
| 101 | +############################################################ |
| 102 | +# 6. Assert that number of certified transactions are the |
| 103 | +# expected ones. |
| 104 | +[connection server1] |
| 105 | +include/assert.inc [Table t1 will contain 3 rows after the above execution] |
| 106 | +include/assert.inc [Table t1 will contain row after the above execution] |
| 107 | +include/assert.inc [Table t1 will contain row after the above execution] |
| 108 | +include/assert.inc [Table t1 will contain row after the above execution] |
| 109 | +include/assert.inc [The value of Count_Transactions_Checked should be 5 after starting group replication] |
| 110 | +include/assert.inc [The value of Count_Conflicts_Detected should be 1 after starting group replication] |
| 111 | + |
| 112 | +############################################################ |
| 113 | +# Clean up. |
| 114 | +[connection server2] |
| 115 | +SET @@GLOBAL.DEBUG= @debug_save2; |
| 116 | +[connection server1] |
| 117 | +DROP TABLE t1; |
| 118 | +include/group_replication_end.inc |
0 commit comments