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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
include/master-slave.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 master]
include/install_semisync.inc
SET GLOBAL binlog_error_action = IGNORE_ERROR;
CREATE TABLE t1(c1 INT) ENGINE=InnoDB;
include/sync_slave_sql_with_master.inc
#
# Test on AFTER_SYNC wait point
# #######################################################################
# Case 1: Single statement transaction
#
[connection server_1]
show status like "rpl_semi_sync_source_yes_tx";
Variable_name Value
Rpl_semi_sync_source_yes_tx 1
SET DEBUG_SYNC= "after_call_after_sync_observer SIGNAL after_sync_done WAIT_FOR end";
INSERT INTO t1 VALUES(1);;
[connection master]
SET DEBUG_SYNC= "now WAIT_FOR after_sync_done";
show status like "rpl_semi_sync_source_yes_tx";
Variable_name Value
Rpl_semi_sync_source_yes_tx 2
include/assert.inc [rpl_semi_sync_source_yes_tx increased 1]
include/assert.inc [Table is empty right now.]
include/sync_slave_sql_with_master.inc
include/assert.inc [Table has 1 record]
[connection master]
SET DEBUG_SYNC= "now SIGNAL end";
[connection server_1]
include/assert.inc [rpl_semi_sync_source_yes_tx increased only 1]
TRUNCATE t1;
#
# Test on AFTER_SYNC wait point
# #######################################################################
# Case 2: Real transaction
#
[connection server_1]
SET DEBUG_SYNC= "after_call_after_sync_observer SIGNAL after_sync_done WAIT_FOR end";
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
[connection master]
SET DEBUG_SYNC= "now WAIT_FOR after_sync_done";
include/assert.inc [rpl_semi_sync_source_yes_tx increased 1]
include/assert.inc [Table is empty right now.]
include/sync_slave_sql_with_master.inc
include/assert.inc [Table has two records]
[connection master]
SET DEBUG_SYNC= "now SIGNAL end";
[connection server_1]
include/assert.inc [rpl_semi_sync_source_yes_tx increased only 1]
TRUNCATE t1;
#
# Test on AFTER_COMMIT wait point
# #######################################################################
# Verify after_sync hook will not be executed
#
SET GLOBAL rpl_semi_sync_source_wait_point= AFTER_COMMIT;
SET DEBUG_SYNC= "before_call_after_commit_observer SIGNAL engine_commit_done
WAIT_FOR end";
INSERT INTO t1 VALUES(1);;
[connection master]
SET DEBUG_SYNC= "now WAIT_FOR engine_commit_done";
include/assert.inc [Table is empty right now.]
include/assert.inc [rpl_semi_sync_source_yes_tx was not increased]
include/assert.inc [rpl_semi_sync_source_no_tx was not increased]
SET DEBUG_SYNC= "now SIGNAL end";
[connection server_1]
SET DEBUG_SYNC= "RESET";
[connection master]
SET DEBUG_SYNC= "RESET";
SET GLOBAL rpl_semi_sync_source_wait_point= AFTER_SYNC;
TRUNCATE t1;
include/sync_slave_sql_with_master.inc
[connection master]
SET GLOBAL binlog_order_commits = OFF;
#
# Test on AFTER_SYNC wait point
# #######################################################################
# Case 1: Single statement transaction
#
[connection server_1]
show status like "rpl_semi_sync_source_yes_tx";
Variable_name Value
Rpl_semi_sync_source_yes_tx 7
SET DEBUG_SYNC= "after_call_after_sync_observer SIGNAL after_sync_done WAIT_FOR end";
INSERT INTO t1 VALUES(1);;
[connection master]
SET DEBUG_SYNC= "now WAIT_FOR after_sync_done";
show status like "rpl_semi_sync_source_yes_tx";
Variable_name Value
Rpl_semi_sync_source_yes_tx 8
include/assert.inc [rpl_semi_sync_source_yes_tx increased 1]
include/assert.inc [Table is empty right now.]
include/sync_slave_sql_with_master.inc
include/assert.inc [Table has 1 record]
[connection master]
SET DEBUG_SYNC= "now SIGNAL end";
[connection server_1]
include/assert.inc [rpl_semi_sync_source_yes_tx increased only 1]
TRUNCATE t1;
#
# Test on AFTER_SYNC wait point
# #######################################################################
# Case 2: Real transaction
#
[connection server_1]
SET DEBUG_SYNC= "after_call_after_sync_observer SIGNAL after_sync_done WAIT_FOR end";
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
[connection master]
SET DEBUG_SYNC= "now WAIT_FOR after_sync_done";
include/assert.inc [rpl_semi_sync_source_yes_tx increased 1]
include/assert.inc [Table is empty right now.]
include/sync_slave_sql_with_master.inc
include/assert.inc [Table has two records]
[connection master]
SET DEBUG_SYNC= "now SIGNAL end";
[connection server_1]
include/assert.inc [rpl_semi_sync_source_yes_tx increased only 1]
TRUNCATE t1;
#
# Test on AFTER_COMMIT wait point
# #######################################################################
# Verify after_sync hook will not be executed
#
SET GLOBAL rpl_semi_sync_source_wait_point= AFTER_COMMIT;
SET DEBUG_SYNC= "before_call_after_commit_observer SIGNAL engine_commit_done
WAIT_FOR end";
INSERT INTO t1 VALUES(1);;
[connection master]
SET DEBUG_SYNC= "now WAIT_FOR engine_commit_done";
include/assert.inc [Table is empty right now.]
include/assert.inc [rpl_semi_sync_source_yes_tx was not increased]
include/assert.inc [rpl_semi_sync_source_no_tx was not increased]
SET DEBUG_SYNC= "now SIGNAL end";
[connection server_1]
SET DEBUG_SYNC= "RESET";
[connection master]
SET DEBUG_SYNC= "RESET";
SET GLOBAL rpl_semi_sync_source_wait_point= AFTER_SYNC;
TRUNCATE t1;
include/sync_slave_sql_with_master.inc
[connection master]
SET GLOBAL binlog_order_commits= 1;
#
# For coverage test, simulate after_sync hook error
#
SET @saved_debug= @@GLOBAL.debug;
SET GLOBAL debug='+d,simulate_after_sync_hook_error';
INSERT INTO t1 VALUES(1);
SELECT * FROM t1;
c1
1
SET GLOBAL debug= @saved_debug;
CALL mtr.add_suppression("Failed to run 'after_sync' hook");
include/rpl_restart_server.inc [server_number=1]
[connection slave]
include/start_slave_io.inc
[connection master]
CALL mtr.add_suppression("An error occurred during sync stage of the commit.");
DROP TABLE t1;
include/uninstall_semisync.inc
include/rpl_end.inc
|