1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
include/group_replication.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
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.
[connection server1]
######################################################################
# Phase 1:
# Recovery only waits for the certification of all cached transactions
######################################################################
#
# Create t1 and t2 on both servers
# Start group replication on server 1 after inserting data on t1
#
server1
SET SESSION sql_log_bin=0;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
SET SESSION sql_log_bin=1;
include/start_and_bootstrap_group_replication.inc
INSERT INTO t1 VALUES (1);
server2
SET SESSION sql_log_bin=0;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
SET SESSION sql_log_bin=1;
#
# Lock table t1 and table t2 on server 2
# Table t1: Blocks first phase of recovery
# Table t2: Blocks second phase of recovery
#
SET @configured_rec_policy= @@GLOBAL.group_replication_recovery_complete_at;
SET GLOBAL group_replication_recovery_complete_at= "transactions_certified";
Warnings:
Warning 1681 'group_replication_recovery_complete_at' is deprecated and will be removed in a future release.
server_2 (server2)
LOCK TABLE t1 READ;
slave (server2)
LOCK TABLE t2 READ;
#
# Start group replication on server 2 and check it is stuck on recovery
#
server2
include/start_group_replication.inc
Warnings:
Warning 1681 'group_replication_recovery_complete_at' is deprecated and will be removed in a future release.
#
# Insert some transaction on server 1 that will be cached on server 2
#
server1
SELECT WAIT_FOR_EXECUTED_GTID_SET('08033a70-3560-11e5-a2cb-0800200c9a66:3');
WAIT_FOR_EXECUTED_GTID_SET('08033a70-3560-11e5-a2cb-0800200c9a66:3')
0
INSERT INTO t2 VALUES (1);
#
# UnLock table t1: First phase of recovery can carry on.
# Member 1 is online as it only waits for certification of cached data
#
server_2 (server2)
UNLOCK TABLES;
server2
include/gr_wait_for_member_state.inc
#
# UnLock table t2: Second phase of recovery can carry on.
# The data should be there.
#
slave (server2)
UNLOCK TABLES;
#
# Phase 1 cleanup
# Remove the data from the tables and stop group replication on server 2
#
server1
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
include/rpl_sync.inc
server2
include/stop_group_replication.inc
######################################################################
# Phase 2:
# Recovery waits for the execution of all executed transactions
######################################################################
#
# Start group replication on server 1 after inserting data on t1
#
server1
INSERT INTO t1 VALUES (1);
#
# Change recovery policy on server 2 to wait for transaction execution.
#
server2
SET GLOBAL group_replication_recovery_complete_at= "transactions_applied";
Warnings:
Warning 1681 'group_replication_recovery_complete_at' is deprecated and will be removed in a future release.
#
# Lock table t1 and table t2 on server 2
# Table t1: Blocks first phase of recovery
# Table t2: Blocks second phase of recovery
#
server_2 (server2)
LOCK TABLE t1 READ;
slave (server2)
LOCK TABLE t2 READ;
#
# Start group replication on server 2 and check it is stuck on recovery
#
server2
include/start_group_replication.inc
#
# Insert some transaction on server 1 that will be cached on server 2
#
server1
INSERT INTO t2 VALUES (1);
#
# Wait for the transactions to be cached on server 2
#
server2
#
# UnLock table t1: First phase of recovery can carry on.
# Member 2 is still recovering as it can't apply cached data
#
server_2 (server2)
UNLOCK TABLES;
server2
include/assert.inc [The value of member_state should be recovering]
#
# UnLock table t2: Second phase of recovery can carry on.
# The data should be there and the member should now be online.
#
slave (server2)
UNLOCK TABLES;
include/gr_wait_for_member_state.inc
#
# Test cleanup
#
server2
DROP TABLE t1;
DROP TABLE t2;
SET GLOBAL group_replication_recovery_complete_at= @configured_rec_policy;
Warnings:
Warning 1681 'group_replication_recovery_complete_at' is deprecated and will be removed in a future release.
include/group_replication_end.inc
|