File: binlog_truncate_active_log.result

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (294 lines) | stat: -rw-r--r-- 10,448 bytes parent folder | download | duplicates (4)
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
call mtr.add_suppression("Can.t init tc log");
call mtr.add_suppression("Aborting");
RESET MASTER;
SET @@global.sync_binlog=1;
CREATE TABLE t (f INT) ENGINE=INNODB;
CREATE TABLE t2 (f INT) ENGINE=INNODB;
CREATE TABLE t4 (f INT) ENGINE=INNODB;
CREATE TABLE tm (f INT) ENGINE=Aria;
# Case A.
connect master1,localhost,root,,;
connect master2,localhost,root,,;
connect master3,localhost,root,,;
connect master4,localhost,root,,;
connection default;
INSERT INTO t  VALUES (10);
INSERT INTO tm VALUES (10);
connection master1;
SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL master1_ready WAIT_FOR signal_never_arrives";
INSERT INTO t VALUES (20);
connection master2;
SET DEBUG_SYNC= "now WAIT_FOR master1_ready";
SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL master2_ready";
DELETE FROM t2 WHERE f = 0 /* no such record */;
connection master3;
SET DEBUG_SYNC= "now WAIT_FOR master2_ready";
SELECT @@global.gtid_binlog_pos as 'Before the crash';
Before the crash
0-1-8
connection master4;
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master4_ready WAIT_FOR signal_never_arrives";
INSERT INTO t4  VALUES (13);
connection master3;
SET DEBUG_SYNC= "now WAIT_FOR master4_ready";
SELECT @@global.gtid_binlog_pos as 'Before the crash and never logged trx';
Before the crash and never logged trx
0-1-8
connection default;
# Kill the server
disconnect master1;
disconnect master2;
disconnect master3;
disconnect master4;
# restart: --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3
FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-7/ in mysqld.1.err
Pre-crash binlog file content:
include/show_binlog_events.inc
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	#	Gtid	#	#	GTID #-#-#
master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t (f INT) ENGINE=INNODB
master-bin.000001	#	Gtid	#	#	GTID #-#-#
master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 (f INT) ENGINE=INNODB
master-bin.000001	#	Gtid	#	#	GTID #-#-#
master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t4 (f INT) ENGINE=INNODB
master-bin.000001	#	Gtid	#	#	GTID #-#-#
master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE tm (f INT) ENGINE=Aria
master-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t  VALUES (10)
master-bin.000001	#	Xid	#	#	COMMIT /* XID */
master-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tm VALUES (10)
master-bin.000001	#	Query	#	#	COMMIT
SELECT @@global.gtid_binlog_pos as 'After the crash';
After the crash
0-1-6
"One row should be present in table 't'"
SELECT * FROM t;
f
10
"No row should be present in table 't4'"
SELECT * FROM t4;
f
DELETE FROM t;
# Case B.
connect master1,localhost,root,,;
connect master2,localhost,root,,;
connect master3,localhost,root,,;
connect master4,localhost,root,,;
connection default;
INSERT INTO t  VALUES (10);
INSERT INTO tm VALUES (10);
connection master1;
SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL master1_ready WAIT_FOR signal_never_arrives";
DELETE FROM t2 WHERE f = 0;
connection master2;
SET DEBUG_SYNC= "now WAIT_FOR master1_ready";
SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL master2_ready";
INSERT INTO t VALUES (20);
connection master3;
SET DEBUG_SYNC= "now WAIT_FOR master2_ready";
SELECT @@global.gtid_binlog_pos as 'Before the crash';
Before the crash
0-1-11
connection master4;
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master4_ready WAIT_FOR signal_never_arrives";
INSERT INTO t4  VALUES (13);
connection master3;
SET DEBUG_SYNC= "now WAIT_FOR master4_ready";
SELECT @@global.gtid_binlog_pos as 'Before the crash and never logged trx';
Before the crash and never logged trx
0-1-11
connection default;
# Kill the server
disconnect master1;
disconnect master2;
disconnect master3;
disconnect master4;
# restart: --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3
FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-11/ in mysqld.1.err
Pre-crash binlog file content:
include/show_binlog_events.inc
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000002	#	Gtid	#	#	BEGIN GTID #-#-#
master-bin.000002	#	Query	#	#	use `test`; DELETE FROM t
master-bin.000002	#	Xid	#	#	COMMIT /* XID */
master-bin.000002	#	Gtid	#	#	BEGIN GTID #-#-#
master-bin.000002	#	Query	#	#	use `test`; INSERT INTO t  VALUES (10)
master-bin.000002	#	Xid	#	#	COMMIT /* XID */
master-bin.000002	#	Gtid	#	#	BEGIN GTID #-#-#
master-bin.000002	#	Query	#	#	use `test`; INSERT INTO tm VALUES (10)
master-bin.000002	#	Query	#	#	COMMIT
master-bin.000002	#	Gtid	#	#	BEGIN GTID #-#-#
master-bin.000002	#	Query	#	#	use `test`; DELETE FROM t2 WHERE f = 0
master-bin.000002	#	Query	#	#	COMMIT
SELECT @@global.gtid_binlog_pos as 'After the crash';
After the crash
0-1-10
"One row should be present in table 't'"
SELECT * FROM t;
f
10
"No row should be present in table 't4'"
SELECT * FROM t4;
f
DELETE FROM t;
# Case C.
CREATE PROCEDURE sp_blank_xa()
BEGIN
XA START   'blank';
DELETE FROM t2 WHERE f = 0 /* no such record */;
XA END     'blank';
XA PREPARE 'blank';
END|
connect master1,localhost,root,,;
connect master2,localhost,root,,;
connect master3,localhost,root,,;
connect master4,localhost,root,,;
connection default;
INSERT INTO t  VALUES (10);
INSERT INTO tm VALUES (10);
connection master1;
SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL master1_ready WAIT_FOR signal_never_arrives";
INSERT INTO t VALUES (20);
connection master2;
SET DEBUG_SYNC= "now WAIT_FOR master1_ready";
SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL master2_ready";
CALL sp_blank_xa;
connection master3;
SET DEBUG_SYNC= "now WAIT_FOR master2_ready";
SELECT @@global.gtid_binlog_pos as 'Before the crash';
Before the crash
0-1-16
connection master4;
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master4_ready WAIT_FOR signal_never_arrives";
INSERT INTO t4  VALUES (13);
connection master3;
SET DEBUG_SYNC= "now WAIT_FOR master4_ready";
SELECT @@global.gtid_binlog_pos as 'Before the crash and never logged trx';
Before the crash and never logged trx
0-1-16
connection default;
# Kill the server
disconnect master1;
disconnect master2;
disconnect master3;
disconnect master4;
# restart: --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3
FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-15/ in mysqld.1.err
Pre-crash binlog file content:
include/show_binlog_events.inc
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000003	#	Gtid	#	#	BEGIN GTID #-#-#
master-bin.000003	#	Query	#	#	use `test`; DELETE FROM t
master-bin.000003	#	Xid	#	#	COMMIT /* XID */
master-bin.000003	#	Gtid	#	#	GTID #-#-#
master-bin.000003	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_blank_xa`()
BEGIN
XA START   'blank';
DELETE FROM t2 WHERE f = 0 /* no such record */;
XA END     'blank';
XA PREPARE 'blank';
END
master-bin.000003	#	Gtid	#	#	BEGIN GTID #-#-#
master-bin.000003	#	Query	#	#	use `test`; INSERT INTO t  VALUES (10)
master-bin.000003	#	Xid	#	#	COMMIT /* XID */
master-bin.000003	#	Gtid	#	#	BEGIN GTID #-#-#
master-bin.000003	#	Query	#	#	use `test`; INSERT INTO tm VALUES (10)
master-bin.000003	#	Query	#	#	COMMIT
SELECT @@global.gtid_binlog_pos as 'After the crash';
After the crash
0-1-14
"One row should be present in table 't'"
SELECT * FROM t;
f
10
"No row should be present in table 't4'"
SELECT * FROM t4;
f
DELETE FROM t;
DROP PROCEDURE sp_blank_xa;
# Case D.
CREATE PROCEDURE sp_xa()
BEGIN
XA START   'xid';
DELETE FROM t WHERE f = 10;
XA END     'xid';
XA PREPARE 'xid';
END|
connect master1,localhost,root,,;
connect master2,localhost,root,,;
connect master3,localhost,root,,;
connect master4,localhost,root,,;
connection default;
INSERT INTO t  VALUES (10);
INSERT INTO tm VALUES (10);
connection master1;
SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL master1_ready WAIT_FOR signal_never_arrives";
CALL sp_xa;
connection master2;
SET DEBUG_SYNC= "now WAIT_FOR master1_ready";
SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL master2_ready";
INSERT INTO t2 VALUES (20);
connection master3;
SET DEBUG_SYNC= "now WAIT_FOR master2_ready";
SELECT @@global.gtid_binlog_pos as 'Before the crash';
Before the crash
0-1-21
connection master4;
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master4_ready WAIT_FOR signal_never_arrives";
INSERT INTO t4  VALUES (13);
connection master3;
SET DEBUG_SYNC= "now WAIT_FOR master4_ready";
SELECT @@global.gtid_binlog_pos as 'Before the crash and never logged trx';
Before the crash and never logged trx
0-1-21
connection default;
# Kill the server
disconnect master1;
disconnect master2;
disconnect master3;
disconnect master4;
# restart: --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3
FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-21/ in mysqld.1.err
Pre-crash binlog file content:
include/show_binlog_events.inc
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000004	#	Gtid	#	#	BEGIN GTID #-#-#
master-bin.000004	#	Query	#	#	use `test`; DELETE FROM t
master-bin.000004	#	Xid	#	#	COMMIT /* XID */
master-bin.000004	#	Gtid	#	#	GTID #-#-#
master-bin.000004	#	Query	#	#	use `test`; DROP PROCEDURE sp_blank_xa
master-bin.000004	#	Gtid	#	#	GTID #-#-#
master-bin.000004	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_xa`()
BEGIN
XA START   'xid';
DELETE FROM t WHERE f = 10;
XA END     'xid';
XA PREPARE 'xid';
END
master-bin.000004	#	Gtid	#	#	BEGIN GTID #-#-#
master-bin.000004	#	Query	#	#	use `test`; INSERT INTO t  VALUES (10)
master-bin.000004	#	Xid	#	#	COMMIT /* XID */
master-bin.000004	#	Gtid	#	#	BEGIN GTID #-#-#
master-bin.000004	#	Query	#	#	use `test`; INSERT INTO tm VALUES (10)
master-bin.000004	#	Query	#	#	COMMIT
master-bin.000004	#	Gtid	#	#	XA START X'786964',X'',1 GTID #-#-#
master-bin.000004	#	Query	#	#	use `test`; DELETE FROM t WHERE f = 10
master-bin.000004	#	Query	#	#	XA END X'786964',X'',1
master-bin.000004	#	XA_prepare	#	#	XA PREPARE X'786964',X'',1
SELECT @@global.gtid_binlog_pos as 'After the crash';
After the crash
0-1-20
"One row should be present in table 't'"
SELECT * FROM t;
f
10
"No row should be present in table 't4'"
SELECT * FROM t4;
f
DELETE FROM t;
DROP PROCEDURE sp_xa;
# Cleanup
DROP TABLE t,t2,tm;
SET @@global.sync_binlog= default;
# End of the tests