| 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. Verify that the entries corresponding to the |
| 9 |
# instrumented memory are in the setup instruments |
| 10 |
# table and the memory summary tables for the event |
| 11 |
# consistent_transactions_prepared. |
| 12 |
SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/consistent_transactions_prepared'; |
| 13 |
NAME ENABLED TIMED PROPERTIES FLAGS VOLATILITY DOCUMENTATION |
| 14 |
memory/group_rpl/consistent_transactions_prepared YES NULL global_statistics 0 Memory used to hold list of transaction info which are prepared for the Group Replication Transaction Consistency Guarantees. |
| 15 |
include/assert.inc ['There should be 1 entry corresponding to the consistent_transactions_prepared in the setup_instruments table after starting GR'] |
| 16 |
SELECT EVENT_NAME FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/consistent_transactions_prepared'; |
| 17 |
EVENT_NAME |
| 18 |
memory/group_rpl/consistent_transactions_prepared |
| 19 |
include/assert.inc ['There should be 1 entry corresponding to the consistent_transactions_prepared in the memory_summary_global_by_event_name table after starting GR'] |
| 20 |
|
| 21 |
############################################################ |
| 22 |
# 2. Verify that the entries corresponding to the |
| 23 |
# instrumented memory are in the setup instruments |
| 24 |
# table and the memory summary tables for the event |
| 25 |
# consistent_transactions_waiting. |
| 26 |
SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/consistent_transactions_waiting'; |
| 27 |
NAME ENABLED TIMED PROPERTIES FLAGS VOLATILITY DOCUMENTATION |
| 28 |
memory/group_rpl/consistent_transactions_waiting YES NULL global_statistics 0 Memory used to hold list of transaction info if there are precedent prepared transactions with consistency AFTER and BEFORE_AND_AFTER to hold the transaction until the prepared are committed. |
| 29 |
include/assert.inc ['There should be 1 entry corresponding to the consistent_transactions_waiting in the setup_instruments table after starting GR'] |
| 30 |
SELECT EVENT_NAME FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/consistent_transactions_waiting'; |
| 31 |
EVENT_NAME |
| 32 |
memory/group_rpl/consistent_transactions_waiting |
| 33 |
include/assert.inc ['There should be 1 entry corresponding to the consistent_transactions_waiting in the memory_summary_global_by_event_name table after starting GR'] |
| 34 |
|
| 35 |
############################################################ |
| 36 |
# 3. Create two tables on the group. |
| 37 |
[connection server1] |
| 38 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY); |
| 39 |
CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY); |
| 40 |
include/rpl_sync.inc |
| 41 |
|
| 42 |
############################################################ |
| 43 |
# 4. Lock table t1 on server2 to block a future update. |
| 44 |
[connection server_2] |
| 45 |
LOCK table t1 READ; |
| 46 |
|
| 47 |
############################################################ |
| 48 |
# 5. Execute transaction T1, the transaction will block on |
| 49 |
# server2 due to the table lock. |
| 50 |
[connection server1] |
| 51 |
BEGIN; |
| 52 |
INSERT INTO t1 VALUES (1); |
| 53 |
INSERT INTO t2 VALUES (1); |
| 54 |
COMMIT; |
| 55 |
|
| 56 |
############################################################ |
| 57 |
# 6. Wait until T1 is delivered to server2. |
| 58 |
[connection server2] |
| 59 |
|
| 60 |
############################################################ |
| 61 |
# 7. Execute a write transaction T2 on server2 with |
| 62 |
# group_replication_consistency= 'BEFORE_AND_AFTER' , it |
| 63 |
# will wait for T1 commit and will make new transactions |
| 64 |
# wait for T2. |
| 65 |
[connection server_2_1] |
| 66 |
SET @@SESSION.group_replication_consistency= 'BEFORE_AND_AFTER'; |
| 67 |
UPDATE t2 SET c1=99 WHERE c1=1; |
| 68 |
[connection server2] |
| 69 |
|
| 70 |
############################################################ |
| 71 |
# 8. Force server1 to block between T2 prepare and commit. |
| 72 |
[connection server_1] |
| 73 |
SET @@GLOBAL.DEBUG= '+d,group_replication_wait_on_after_applier_prepare'; |
| 74 |
|
| 75 |
############################################################ |
| 76 |
# 9. Unblock T1 on server2. |
| 77 |
[connection server_2] |
| 78 |
UNLOCK TABLES; |
| 79 |
[connection server_2_1] |
| 80 |
SET @@SESSION.group_replication_consistency= DEFAULT; |
| 81 |
|
| 82 |
############################################################ |
| 83 |
# 10. Wait until T2 reaches prepare on server1 and then |
| 84 |
# verify that the number of bytes allocated for |
| 85 |
# consistent_members_that_prepare_transaction |
| 86 |
# event is greater than 0. |
| 87 |
[connection server_1] |
| 88 |
SET DEBUG_SYNC= "now WAIT_FOR signal.after_applier_prepare_waiting"; |
| 89 |
include/assert.inc ['The sum of bytes allocated must be greater than 0'] |
| 90 |
|
| 91 |
############################################################ |
| 92 |
# 11. Now that T2 is prepared on server1 but it is not yet |
| 93 |
# committed, new transactions (T3) are hold on server1. |
| 94 |
# Also it verifies that the number of bytes allocated |
| 95 |
# for consistent_transactions_waiting event is |
| 96 |
# greater than 0. |
| 97 |
[connection server_1_1] |
| 98 |
SELECT COUNT(*) AS count FROM t2 WHERE c1=99; |
| 99 |
[connection server1] |
| 100 |
include/assert.inc ['The sum of bytes allocated must be greater than 0'] |
| 101 |
|
| 102 |
############################################################ |
| 103 |
# 12. Unblock T2 prepare on server1. |
| 104 |
[connection server_1] |
| 105 |
SET @@GLOBAL.DEBUG= '-d,group_replication_wait_on_after_applier_prepare'; |
| 106 |
SET DEBUG_SYNC= 'now SIGNAL signal.after_applier_prepare_continue'; |
| 107 |
[connection server_1_1] |
| 108 |
count |
| 109 |
1 |
| 110 |
|
| 111 |
############################################################ |
| 112 |
# 13. Validate data. |
| 113 |
[connection server1] |
| 114 |
include/assert.inc ['There is 1 value in table t1'] |
| 115 |
include/assert.inc ['There is 1 value in table t2'] |
| 116 |
[connection server2] |
| 117 |
include/assert.inc ['There is 1 value in table t1'] |
| 118 |
include/assert.inc ['There is 1 value in table t2'] |
| 119 |
include/diff_tables.inc [server1:t1, server2:t1] |
| 120 |
include/diff_tables.inc [server1:t2, server2:t2] |
| 121 |
|
| 122 |
############################################################ |
| 123 |
# 14. Clean up and stop GR on server 1. |
| 124 |
[connection server1] |
| 125 |
DROP TABLE t1; |
| 126 |
DROP TABLE t2; |
| 127 |
include/stop_group_replication.inc |
| 128 |
include/uninstall_group_replication_plugin.inc |
| 129 |
|
| 130 |
############################################################## |
| 131 |
# 15. Verify that the entries corresponding to the instrumented |
| 132 |
# consistent_transactions_prepared remain in the |
| 133 |
# tables after stopping GR. |
| 134 |
SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/consistent_transactions_prepared'; |
| 135 |
NAME ENABLED TIMED PROPERTIES FLAGS VOLATILITY DOCUMENTATION |
| 136 |
memory/group_rpl/consistent_transactions_prepared YES NULL global_statistics 0 Memory used to hold list of transaction info which are prepared for the Group Replication Transaction Consistency Guarantees. |
| 137 |
include/assert.inc ['There should be 1 entry corresponding to the consistent_transactions_prepared in the setup_instruments table after stopping GR'] |
| 138 |
include/assert.inc ['There should be 1 entry corresponding to the consistent_transactions_prepared in the memory_summary_global_by_event_name table after stopping GR'] |
| 139 |
|
| 140 |
############################################################## |
| 141 |
# 16. Verify that the entries corresponding to the instrumented |
| 142 |
# consistent_transactions_waiting remain in the |
| 143 |
# tables after stopping GR. |
| 144 |
SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/consistent_transactions_waiting'; |
| 145 |
NAME ENABLED TIMED PROPERTIES FLAGS VOLATILITY DOCUMENTATION |
| 146 |
memory/group_rpl/consistent_transactions_waiting YES NULL global_statistics 0 Memory used to hold list of transaction info if there are precedent prepared transactions with consistency AFTER and BEFORE_AND_AFTER to hold the transaction until the prepared are committed. |
| 147 |
include/assert.inc ['There should be 1 entry corresponding to the consistent_transactions_waiting in the setup_instruments table after stopping GR'] |
| 148 |
include/assert.inc ['There should be 1 entry corresponding to the consistent_transactions_waiting in the memory_summary_global_by_event_name table after stopping GR'] |
| 149 |
|
| 150 |
################################################################# |
| 151 |
# 17. Verify that the number of bytes allocated for |
| 152 |
# consistent_transactions_prepared |
| 153 |
# event must be 0. |
| 154 |
include/assert.inc ['The sum of bytes allocated must be zero after stopping GR'] |
| 155 |
|
| 156 |
################################################################# |
| 157 |
# 18. Verify that the number of bytes allocated for |
| 158 |
# consistent_transactions_waiting |
| 159 |
# event must be 0. |
| 160 |
include/assert.inc ['The sum of bytes allocated must be zero after stopping GR'] |
| 161 |
|
| 162 |
############################################################ |
| 163 |
# 19. Clean up. |
| 164 |
include/install_group_replication_plugin.inc |
| 165 |
include/group_replication_end.inc |