File: rpl_semi_sync_after_sync.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (142 lines) | stat: -rw-r--r-- 4,939 bytes parent folder | download
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
--echo #
--echo # Test on AFTER_SYNC wait point
--echo # #######################################################################
--echo # Case 1: Single statement transaction
--echo #
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--let $yes_tx= query_get_value(SHOW STATUS LIKE 'Rpl_semi_sync_source_yes_tx', Value, 1)
show status like "rpl_semi_sync_source_yes_tx";
SET DEBUG_SYNC= "after_call_after_sync_observer SIGNAL after_sync_done WAIT_FOR end";
--send INSERT INTO t1 VALUES(1);

--source include/rpl_connection_master.inc
SET DEBUG_SYNC= "now WAIT_FOR after_sync_done";

show status like "rpl_semi_sync_source_yes_tx";
--let $assert_text= rpl_semi_sync_source_yes_tx increased 1
--disable_warnings
--let $assert_cond= VARIABLE_VALUE = $yes_tx+1 FROM performance_schema.global_status WHERE VARIABLE_NAME = "rpl_semi_sync_source_yes_tx"
--enable_warnings
--source include/assert.inc

--let $assert_text= Table is empty right now.
--let $assert_cond= COUNT(*) = 0 FROM t1
--source include/assert.inc

--source include/sync_slave_sql_with_master.inc

--let $assert_text= Table has 1 record
--let $assert_cond= COUNT(*) = 1 FROM t1;
--source include/assert.inc

--source include/rpl_connection_master.inc
SET DEBUG_SYNC= "now SIGNAL end";

--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--reap

# Varify that after_commit hook is not executed.
--let $assert_text= rpl_semi_sync_source_yes_tx increased only 1
--disable_warnings
--let $assert_cond= VARIABLE_VALUE = $yes_tx+1 FROM performance_schema.global_status WHERE VARIABLE_NAME = "rpl_semi_sync_source_yes_tx"
--enable_warnings
--source include/assert.inc

TRUNCATE t1;

--echo #
--echo # Test on AFTER_SYNC wait point
--echo # #######################################################################
--echo # Case 2: Real transaction
--echo #

--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--let $yes_tx= query_get_value(SHOW STATUS LIKE 'Rpl_semi_sync_source_yes_tx', Value, 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);
--send COMMIT

--source include/rpl_connection_master.inc
SET DEBUG_SYNC= "now WAIT_FOR after_sync_done";

--let $assert_text= rpl_semi_sync_source_yes_tx increased 1
--disable_warnings
--let $assert_cond= VARIABLE_VALUE = $yes_tx+1 FROM performance_schema.global_status WHERE VARIABLE_NAME = "rpl_semi_sync_source_yes_tx"
--enable_warnings
--source include/assert.inc

--let $assert_text= Table is empty right now.
--let $assert_cond= COUNT(*) = 0 FROM t1
--source include/assert.inc

--source include/sync_slave_sql_with_master.inc

--let $assert_text= Table has two records
--let $assert_cond= COUNT(*) = 2 FROM t1;
--source include/assert.inc

--source include/rpl_connection_master.inc
SET DEBUG_SYNC= "now SIGNAL end";

--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--reap

# Varify that after_commit hook is not executed.
--let $assert_text= rpl_semi_sync_source_yes_tx increased only 1
--disable_warnings
--let $assert_cond= VARIABLE_VALUE = $yes_tx+1 FROM performance_schema.global_status WHERE VARIABLE_NAME = "rpl_semi_sync_source_yes_tx"
--enable_warnings
--source include/assert.inc

TRUNCATE t1;

--echo #
--echo # Test on AFTER_COMMIT wait point
--echo # #######################################################################
--echo # Verify after_sync hook will not be executed
--echo #
--let $yes_tx= query_get_value(SHOW STATUS LIKE 'Rpl_semi_sync_source_yes_tx', Value, 1)
--let $no_tx= query_get_value(SHOW STATUS LIKE 'Rpl_semi_sync_source_no_tx', Value, 1)

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";
--send INSERT INTO t1 VALUES(1);

--source include/rpl_connection_master.inc
SET DEBUG_SYNC= "now WAIT_FOR engine_commit_done";

--let $assert_text= Table is empty right now.
--let $assert_cond= COUNT(*) = 1 FROM t1
--source include/assert.inc

--let $assert_text= rpl_semi_sync_source_yes_tx was not increased
--disable_warnings
--let $assert_cond= VARIABLE_VALUE = $yes_tx FROM performance_schema.global_status WHERE VARIABLE_NAME = "rpl_semi_sync_source_yes_tx"
--enable_warnings
--source include/assert.inc

--let $assert_text= rpl_semi_sync_source_no_tx was not increased
--disable_warnings
--let $assert_cond= VARIABLE_VALUE = $no_tx FROM performance_schema.global_status WHERE VARIABLE_NAME = "rpl_semi_sync_source_no_tx"
--enable_warnings
--source include/assert.inc

SET DEBUG_SYNC= "now SIGNAL end";
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--reap

SET DEBUG_SYNC= "RESET";
--source include/rpl_connection_master.inc
SET DEBUG_SYNC= "RESET";
SET GLOBAL rpl_semi_sync_source_wait_point= AFTER_SYNC;
TRUNCATE t1;
--source include/sync_slave_sql_with_master.inc