Debian Codegraph @

mysql-test/suite/rpl/r/rpl_delayed_slave.result

raw
1 include/master-slave.inc
2 [connection master]
3 call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
4 connection slave;
5 call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
6 include/stop_slave.inc
7 CHANGE MASTER TO MASTER_USE_GTID=NO;
8 include/start_slave.inc
9 connection master;
10 [on master]
11 CREATE TABLE t1 (a VARCHAR(100), b INT);
12 INSERT INTO t1 VALUES ("zero", 0);
13 ==== Normal setup ====
14 [on slave]
15 connection slave;
16 include/stop_slave.inc
17 # CHANGE MASTER TO MASTER_DELAY = 2*T
18 include/start_slave.inc
19 # Asserted this: SHOW SLAVE STATUS should return the same delay that we set with CHANGE MASTER
20 [on master]
21 connection master;
22 INSERT INTO t1 VALUES ('normal setup', 1);
23 connection master;
24 [on slave]
25 include/sync_slave_io_with_master.inc
26 # sleep 1*T
27 # Asserted this: Query 1 should not be executed
28 # Asserted this: Status should be 'Waiting until MASTER_DELAY...'
29 # sleep 1*T
30 # sync with master (with timeout 1*T)
31 include/wait_for_slave_param.inc [Relay_Master_Log_File]
32 include/wait_for_slave_param.inc [Exec_Master_Log_Pos]
33 # Asserted this: Query 1 should be executed
34 # Asserted this: Status should be 'Has read all relay log...'
35 include/check_slave_is_running.inc
36 ==== Slave lags "naturally" after master ====
37 [on master]
38 connection master;
39 # CREATE FUNCTION delay_on_slave(time_units INT) RETURNS INT BEGIN IF @@GLOBAL.server_id = 2 THEN RETURN SLEEP(time_units * T); ELSE RETURN 0; END IF; END
40 INSERT INTO t1 SELECT delay_on_slave(3), 2;
41 Warnings:
42 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
43 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave
44 INSERT INTO t1 VALUES ('slave is already lagging: this statement should execute immediately', 3);
45 INSERT INTO t1 SELECT delay_on_slave(2), 4;
46 Warnings:
47 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
48 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave
49 [on slave]
50 include/sync_slave_io_with_master.inc
51 # sleep 1*T
52 # Asserted this: No query executed
53 # Asserted this: Status should be 'Waiting until MASTER_DELAY...'
54 # wait for first query to execute
55 # sleep 1*T
56 # Asserted this: Second query executed
57 # Asserted this: Status should be executing third query (i.e., 'User sleep')
58 # sleep 2*T
59 # Asserted this: Third query executed
60 # Asserted this: Status should be 'Has read all relay log...'
61 ==== Seconds_Behind_Master ====
62 # Bring slave to sync.
63 include/stop_slave.inc
64 CHANGE MASTER TO MASTER_DELAY = 0;
65 include/start_slave.inc
66 connection master;
67 INSERT INTO t1 VALUES ('Syncing slave', 5);
68 connection slave;
69 include/stop_slave.inc
70 # CHANGE MASTER TO MASTER_DELAY = 2*T
71 include/start_slave.inc
72 connection master;
73 INSERT INTO t1 VALUES ('Syncing slave', 5);
74 connection slave;
75 connection master;
76 INSERT INTO t1 VALUES (delay_on_slave(1), 6);
77 Warnings:
78 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
79 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave
80 connection slave;
81 # sleep 1*T
82 # Asserted this: Seconds_Behind_Master should be between 0 and the 2*T
83 # sleep 1*T
84 # Asserted this: Seconds_Behind_Master should be at least 2*T
85 ==== STOP SLAVE / START SLAVE + DML ====
86 include/stop_slave.inc
87 # CHANGE MASTER TO MASTER_DELAY = 3*T
88 include/start_slave.inc
89 [on master]
90 connection master;
91 INSERT INTO t1 VALUES ('stop slave and start slave: DML', 7);
92 [on slave]
93 connection slave;
94 # sleep 1*T
95 include/stop_slave.inc
96 # Asserted this: STOP SLAVE should finish quickly, not wait for the ongoing sleep to finish
97 # Asserted this: SQL thread position should not increase after STOP SLAVE
98 # Asserted this: Query should not be executed after STOP SLAVE
99 # Asserted this: Status should be '' after STOP SLAVE
100 include/start_slave.inc
101 # Asserted this: START SLAVE should finish quickly
102 connection master;
103 [on slave]
104 include/sync_slave_io_with_master.inc
105 # sleep 1*T
106 # Asserted this: Query 7 should not be executed
107 # Asserted this: Status should be 'Waiting until MASTER_DELAY...'
108 # sleep 1*T
109 # sync with master (with timeout 1*T)
110 include/wait_for_slave_param.inc [Relay_Master_Log_File]
111 include/wait_for_slave_param.inc [Exec_Master_Log_Pos]
112 # Asserted this: Query 7 should be executed
113 # Asserted this: Status should be 'Has read all relay log...'
114 include/check_slave_is_running.inc
115 ==== STOP SLAVE / START SLAVE + DDL ====
116 This verifies BUG#56442
117 [on master]
118 connection master;
119 CREATE TABLE t_check_dml_not_executed_prematurely (a INT);
120 include/save_master_pos.inc
121 [on slave]
122 connection slave;
123 # sleep 1*T
124 include/stop_slave.inc
125 # Asserted this: STOP SLAVE should finish quickly, not wait for the ongoing sleep to finish
126 # Asserted this: SQL thread position should not increase after STOP SLAVE
127 # Asserted this: Query should not be executed after STOP SLAVE
128 # Asserted this: Status should be '' after STOP SLAVE
129 include/start_slave.inc
130 # Asserted this: START SLAVE should finish quickly
131 # sleep 1*T
132 # Asserted this: DDL Query should not be executed after START SLAVE
133 # Asserted this: Status should be 'Waiting until MASTER_DELAY...'
134 # sleep 1*T
135 # sync with master (with timeout 1*T)
136 include/wait_for_slave_param.inc [Relay_Master_Log_File]
137 include/wait_for_slave_param.inc [Exec_Master_Log_Pos]
138 # Asserted this: DDL Query should be executed
139 # Asserted this: Status should be 'Has read all relay log...'
140 include/check_slave_is_running.inc
141 ==== Change back to no delay ====
142 [on slave]
143 connection slave;
144 include/stop_slave.inc
145 CHANGE MASTER TO MASTER_DELAY = 0;
146 # Asserted this: Delay should be 0 when we set it to 0
147 include/start_slave.inc
148 [on master]
149 connection master;
150 INSERT INTO t1 VALUES ('change back to no delay', 8);
151 [on slave]
152 include/sync_slave_io_with_master.inc
153 # sleep 1*T
154 # Asserted this: Query should be executed
155 # Asserted this: Status should be 'Slave has read all relay log...'
156 ==== Reset delay with RESET SLAVE ====
157 include/stop_slave.inc
158 CHANGE MASTER TO MASTER_DELAY = 71;
159 include/start_slave.inc
160 # Asserted this: Delay should be 71 when we set it to 71
161 include/stop_slave.inc
162 include/reset_slave.inc
163 Warnings:
164 Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
165 [on master]
166 connection master;
167 RESET MASTER;
168 [on slave]
169 connection slave;
170 include/start_slave.inc
171 # Asserted this: Delay should be 0 after RESET SLAVE
172 ==== Set an invalid value for the delay ====
173 include/stop_slave.inc
174 # Expect error for setting negative delay
175 CHANGE MASTER TO MASTER_DELAY = -1;
176 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1' at line 1
177 # Expect that it's ok to set delay of 2^31-1
178 CHANGE MASTER TO MASTER_DELAY = 2147483647;
179 # Expect error for setting delay between 2^31 and 2^32-1
180 CHANGE MASTER TO MASTER_DELAY = 2147483648;
181 ERROR HY000: The requested value 2147483648 for the master delay exceeds the maximum 2147483647
182 # Expect error for setting delay to nonsense
183 CHANGE MASTER TO MASTER_DELAY = blah;
184 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'blah' at line 1
185 CHANGE MASTER TO MASTER_DELAY = 0;
186 include/start_slave.inc
187 ==== Clean up ====
188 [on master]
189 connection master;
190 DROP TABLE t1, t_check_dml_not_executed_prematurely;
191 DROP FUNCTION delay_on_slave;
192 [on slave]
193 connection slave;
194 SELECT @@GLOBAL.slave_parallel_mode;
195 @@GLOBAL.slave_parallel_mode
196 optimistic
197 SELECT @@GLOBAL.slave_parallel_threads;
198 @@GLOBAL.slave_parallel_threads
199 0
200 include/rpl_end.inc