Debian Codegraph @

mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result

raw
1 call mtr.add_suppression("Can.t init tc log");
2 call mtr.add_suppression("Aborting");
3 SET @@global.sync_binlog= 1;
4 CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
5 CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=rocksdb;
6 #
7 #
8 # Case "A" : "neither engine committed => rollback & binlog truncate"
9 #
10 RESET MASTER;
11 FLUSH LOGS;
12 SET GLOBAL max_binlog_size= 4096;
13 connect con1,localhost,root,,;
14 List of binary logs before rotation
15 show binary logs;
16 Log_name File_size
17 master-bin.000001 #
18 master-bin.000002 #
19 INSERT INTO t1 VALUES (1, REPEAT("x", 1));
20 INSERT INTO t2 VALUES (1, REPEAT("x", 1));
21 BEGIN;
22 INSERT INTO t2 VALUES (2, REPEAT("x", 4100));
23 INSERT INTO t1 VALUES (2, REPEAT("x", 4100));
24 SET DEBUG_SYNC= "commit_after_release_LOCK_log SIGNAL con1_ready WAIT_FOR signal_no_signal";
25 COMMIT;
26 connection default;
27 SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
28 List of binary logs after rotation
29 show binary logs;
30 Log_name File_size
31 master-bin.000001 #
32 master-bin.000002 #
33 master-bin.000003 #
34 # restart the server with --init-rpl-role=SLAVE --sync-binlog=1
35 # the server is restarted
36 # restart: --init-rpl-role=SLAVE --sync-binlog=1
37 connection default;
38 #
39 # *** Summary: 1 row should be present in both tables; binlog is truncated; number of binlogs at reconnect - 3:
40 #
41 SELECT COUNT(*) FROM t1;
42 COUNT(*)
43 1
44 SELECT COUNT(*) FROM t2;
45 COUNT(*)
46 1
47 SELECT @@GLOBAL.gtid_binlog_state;
48 @@GLOBAL.gtid_binlog_state
49 0-1-2
50 SELECT @@GLOBAL.gtid_binlog_pos;
51 @@GLOBAL.gtid_binlog_pos
52 0-1-2
53 List of binary logs at the end of the tests
54 show binary logs;
55 Log_name File_size
56 master-bin.000001 #
57 master-bin.000002 #
58 master-bin.000003 #
59 # ***
60 DELETE FROM t1;
61 DELETE FROM t2;
62 disconnect con1;
63 #
64 Proof of the truncated binlog file is readable (two transactions must be seen):
65 /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
66 /*!40019 SET @@session.max_delayed_threads=0*/;
67 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
68 DELIMITER /*!*/;
69 START TRANSACTION
70 /*!*/;
71 COMMIT/*!*/;
72 START TRANSACTION
73 /*!*/;
74 COMMIT/*!*/;
75 DELIMITER ;
76 # End of log file
77 ROLLBACK /* added by mysqlbinlog */;
78 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
79 /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
80 #
81 #
82 # Case "B" : "one engine has committed its transaction branch"
83 #
84 RESET MASTER;
85 FLUSH LOGS;
86 SET GLOBAL max_binlog_size= 4096;
87 connect con1,localhost,root,,;
88 List of binary logs before rotation
89 show binary logs;
90 Log_name File_size
91 master-bin.000001 #
92 master-bin.000002 #
93 INSERT INTO t1 VALUES (1, REPEAT("x", 1));
94 INSERT INTO t2 VALUES (1, REPEAT("x", 1));
95 SET GLOBAL debug_dbug="d,enable_log_write_upto_crash";
96 BEGIN;
97 INSERT INTO t2 VALUES (2, REPEAT("x", 4100));
98 INSERT INTO t1 VALUES (2, REPEAT("x", 4100));
99 COMMIT;
100 connection default;
101 # restart: --init-rpl-role=SLAVE --sync-binlog=1
102 connection default;
103 #
104 # *** Summary: 2 rows should be present in both tables; no binlog truncation; one extra binlog file compare with A; number of binlogs at reconnect - 4:
105 #
106 SELECT COUNT(*) FROM t1;
107 COUNT(*)
108 2
109 SELECT COUNT(*) FROM t2;
110 COUNT(*)
111 2
112 SELECT @@GLOBAL.gtid_binlog_state;
113 @@GLOBAL.gtid_binlog_state
114 0-1-3
115 SELECT @@GLOBAL.gtid_binlog_pos;
116 @@GLOBAL.gtid_binlog_pos
117 0-1-3
118 List of binary logs at the end of the tests
119 show binary logs;
120 Log_name File_size
121 master-bin.000001 #
122 master-bin.000002 #
123 master-bin.000003 #
124 master-bin.000004 #
125 # ***
126 DELETE FROM t1;
127 DELETE FROM t2;
128 disconnect con1;
129 #
130 #
131 #
132 # Case "C" : "both engines have committed its transaction branch"
133 #
134 RESET MASTER;
135 FLUSH LOGS;
136 SET GLOBAL max_binlog_size= 4096;
137 connect con1,localhost,root,,;
138 List of binary logs before rotation
139 show binary logs;
140 Log_name File_size
141 master-bin.000001 #
142 master-bin.000002 #
143 INSERT INTO t1 VALUES (1, REPEAT("x", 1));
144 INSERT INTO t2 VALUES (1, REPEAT("x", 1));
145 BEGIN;
146 INSERT INTO t2 VALUES (2, REPEAT("x", 4100));
147 INSERT INTO t1 VALUES (2, REPEAT("x", 4100));
148 SET DEBUG_SYNC= "commit_after_run_commit_ordered SIGNAL con1_ready";
149 COMMIT;
150 connection default;
151 SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
152 List of binary logs after rotation
153 show binary logs;
154 Log_name File_size
155 master-bin.000001 #
156 master-bin.000002 #
157 master-bin.000003 #
158 # restart the server with --init-rpl-role=SLAVE --sync-binlog=1
159 # the server is restarted
160 # restart: --init-rpl-role=SLAVE --sync-binlog=1
161 connection default;
162 #
163 # *** Summary: 2 rows should be present in both tables; no binlog truncation; the same # of binlog files as in B; number of binlogs at reconnect - 4:
164 #
165 SELECT COUNT(*) FROM t1;
166 COUNT(*)
167 2
168 SELECT COUNT(*) FROM t2;
169 COUNT(*)
170 2
171 SELECT @@GLOBAL.gtid_binlog_state;
172 @@GLOBAL.gtid_binlog_state
173 0-1-3
174 SELECT @@GLOBAL.gtid_binlog_pos;
175 @@GLOBAL.gtid_binlog_pos
176 0-1-3
177 List of binary logs at the end of the tests
178 show binary logs;
179 Log_name File_size
180 master-bin.000001 #
181 master-bin.000002 #
182 master-bin.000003 #
183 master-bin.000004 #
184 # ***
185 DELETE FROM t1;
186 DELETE FROM t2;
187 disconnect con1;
188 #
189 DROP TABLE t1, t2;
190 SET @@global.sync_binlog= default;
191 # End of the tests