Debian Codegraph @

mysql-test/suite/ndb_binlog/r/ndb_binlog_index.result

raw
1 -------------------------------------------------
2 First run using ndb_binlog_index table containing
3 epoch end position information
4 -------------------------------------------------
5 show create table mysql.ndb_binlog_index;
6 Table Create Table
7 ndb_binlog_index CREATE TABLE `ndb_binlog_index` (
8 `Position` bigint unsigned NOT NULL,
9 `File` varchar(255) NOT NULL,
10 `epoch` bigint unsigned NOT NULL,
11 `inserts` int unsigned NOT NULL,
12 `updates` int unsigned NOT NULL,
13 `deletes` int unsigned NOT NULL,
14 `schemaops` int unsigned NOT NULL,
15 `orig_server_id` int unsigned NOT NULL,
16 `orig_epoch` bigint unsigned NOT NULL,
17 `gci` int unsigned NOT NULL,
18 `next_position` bigint unsigned NOT NULL,
19 `next_file` varchar(255) NOT NULL,
20 PRIMARY KEY (`epoch`,`orig_server_id`,`orig_epoch`)
21 ) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC
22 mysql.ndb_binlog_index has next_file column? 1
23 create table t1 (a int, b varchar(400)) engine=ndb;
24 Test pure epochs
25 ----------------
26 insert into t1 values(1, repeat('B', 400));
27 insert into t1 values(1, repeat('F', 400));
28 insert into t1 values(1, repeat('E', 400));
29 flush logs;
30 ---------------------------------------------------------------------------
31 Mismatches between Binlog index next_pos and Binlog COMMIT event pos
32 ---------------------------------------------------------------------------
33 epoch calculated_pos stored_pos
34 Done
35 reset master;
36 Test interleaved epochs and DDL
37 ------------------------------
38 insert into t1 values(1, repeat('R', 400));
39 create table t2 (a int) engine=ndb;
40 insert into t1 values(1, repeat('A', 400));
41 create table t3 (a int) engine=ndb;
42 insert into t1 value(1, repeat('A', 400));
43 flush logs;
44 ---------------------------------------------------------------------------
45 Mismatches between Binlog index next_pos and Binlog COMMIT event pos
46 ---------------------------------------------------------------------------
47 epoch calculated_pos stored_pos
48 Done
49 Test multithreaded interleaved epochs and DDL
50 ---------------------------------------------
51 Issue DDL and DML concurrently on server1
52 They will interleave in the Binlog according to Binlog mutex
53 interactions between DDL executing server thread and binlog injector
54
55 Check Binlog on DDL-source MySQLD to ensure that binlog index positions
56 'cover' the Binlog
57 Check Binlog on other MySQLD to ensure that binlog index positions
58 'cover' the Binlog (DDL here is 'fabricated' by Binlog injector thread
59
60 reset master;
61 reset master;
62 set sql_log_bin=0;
63 create table dmlload_stop (
64 value int primary key
65 );
66 create procedure dmlload ()
67 begin
68 declare stop int default 0;
69 repeat
70 start transaction;
71 insert into t1 values (2, repeat('I', 400));
72 commit;
73 start transaction;
74 update t1 set b=repeat('Z', 400) where a=2;
75 commit;
76 start transaction;
77 delete from t1 where a=2;
78 commit;
79 select value from dmlload_stop where value = 1 into stop;
80 until stop
81 end repeat;
82 end%
83 set sql_log_bin=1;
84 call dmlload();
85 insert into dmlload_stop values(1);
86 Now check binlog index vs binlog itself on Server1
87 flush logs;
88 ---------------------------------------------------------------------------
89 Mismatches between Binlog index next_pos and Binlog COMMIT event pos
90 ---------------------------------------------------------------------------
91 epoch calculated_pos stored_pos
92 Done
93 Now check binlog index vs binlog itself on Server2
94 flush logs;
95 ---------------------------------------------------------------------------
96 Mismatches between Binlog index next_pos and Binlog COMMIT event pos
97 ---------------------------------------------------------------------------
98 epoch calculated_pos stored_pos
99 Done
100 drop procedure dmlload;
101 drop table dmlload_stop;
102 Cleanup
103 drop table t1;
104 drop table t2;
105 drop table t3;
106 ------------------------------------------------
107 Second run using ndb_binlog_index table without
108 epoch end position information
109 ------------------------------------------------
110 alter table mysql.ndb_binlog_index drop column next_file;
111 alter table mysql.ndb_binlog_index drop column next_position;
112 reset master;
113 show create table mysql.ndb_binlog_index;
114 Table Create Table
115 ndb_binlog_index CREATE TABLE `ndb_binlog_index` (
116 `Position` bigint unsigned NOT NULL,
117 `File` varchar(255) NOT NULL,
118 `epoch` bigint unsigned NOT NULL,
119 `inserts` int unsigned NOT NULL,
120 `updates` int unsigned NOT NULL,
121 `deletes` int unsigned NOT NULL,
122 `schemaops` int unsigned NOT NULL,
123 `orig_server_id` int unsigned NOT NULL,
124 `orig_epoch` bigint unsigned NOT NULL,
125 `gci` int unsigned NOT NULL,
126 PRIMARY KEY (`epoch`,`orig_server_id`,`orig_epoch`)
127 ) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC
128 mysql.ndb_binlog_index has next_file column? 0
129 create table t1 (a int, b varchar(400)) engine=ndb;
130 Test pure epochs
131 ----------------
132 insert into t1 values(1, repeat('B', 400));
133 insert into t1 values(1, repeat('F', 400));
134 insert into t1 values(1, repeat('E', 400));
135 flush logs;
136 Nothing to verify
137 reset master;
138 Test interleaved epochs and DDL
139 ------------------------------
140 insert into t1 values(1, repeat('R', 400));
141 create table t2 (a int) engine=ndb;
142 insert into t1 values(1, repeat('A', 400));
143 create table t3 (a int) engine=ndb;
144 insert into t1 value(1, repeat('A', 400));
145 flush logs;
146 Nothing to verify
147 Test multithreaded interleaved epochs and DDL
148 ---------------------------------------------
149 Issue DDL and DML concurrently on server1
150 They will interleave in the Binlog according to Binlog mutex
151 interactions between DDL executing server thread and binlog injector
152
153 Check Binlog on DDL-source MySQLD to ensure that binlog index positions
154 'cover' the Binlog
155 Check Binlog on other MySQLD to ensure that binlog index positions
156 'cover' the Binlog (DDL here is 'fabricated' by Binlog injector thread
157
158 reset master;
159 reset master;
160 set sql_log_bin=0;
161 create table dmlload_stop (
162 value int primary key
163 );
164 create procedure dmlload ()
165 begin
166 declare stop int default 0;
167 repeat
168 start transaction;
169 insert into t1 values (2, repeat('I', 400));
170 commit;
171 start transaction;
172 update t1 set b=repeat('Z', 400) where a=2;
173 commit;
174 start transaction;
175 delete from t1 where a=2;
176 commit;
177 select value from dmlload_stop where value = 1 into stop;
178 until stop
179 end repeat;
180 end%
181 set sql_log_bin=1;
182 call dmlload();
183 insert into dmlload_stop values(1);
184 Now check binlog index vs binlog itself on Server1
185 flush logs;
186 Nothing to verify
187 Now check binlog index vs binlog itself on Server2
188 flush logs;
189 ---------------------------------------------------------------------------
190 Mismatches between Binlog index next_pos and Binlog COMMIT event pos
191 ---------------------------------------------------------------------------
192 epoch calculated_pos stored_pos
193 Done
194 drop procedure dmlload;
195 drop table dmlload_stop;
196 Cleanup
197 drop table t1;
198 drop table t2;
199 drop table t3;
200 Now restore original schema
201 reset master;
202 alter table mysql.ndb_binlog_index add column next_position bigint unsigned not null;
203 alter table mysql.ndb_binlog_index add column next_file varchar(255) not null;
204 reset master;
205 --------------------------------------
206 Quick test of ndb-log-empty-epochs = 1
207 --------------------------------------
208 select * from mysql.ndb_binlog_index order by epoch;
209 Position File epoch inserts updates deletes schemaops orig_server_id orig_epoch gci next_position next_file
210 include/show_binlog_events.inc
211 Log_name Pos Event_type Server_id End_log_pos Info
212 show variables like 'ndb_log_empty_epochs';
213 Variable_name Value
214 ndb_log_empty_epochs OFF
215 set global ndb_log_empty_epochs=1;
216 show variables like 'ndb_log_empty_epochs';
217 Variable_name Value
218 ndb_log_empty_epochs ON
219 Allow some empty epochs to pass...
220 Show that we have entries in ndb_binlog_index
221 select count(1) > 0 from mysql.ndb_binlog_index;
222 count(1) > 0
223 1
224 Show that all ndb_binlog_index entries have the same file + position
225 select bi1.epoch, bi1.Position, bi1.File, bi1.next_position, bi1.next_file,
226 bi2.epoch, bi2.Position, bi2.File, bi2.next_position, bi2.next_file
227 from mysql.ndb_binlog_index as bi1,
228 mysql.ndb_binlog_index as bi2
229 where
230 # Start and Next not same
231 bi1.Position != bi1.next_position OR
232 bi1.File != bi1.next_file OR
233 # All epochs not the same
234 bi1.Position != bi2.Position OR
235 bi1.File != bi2.File;
236 epoch Position File next_position next_file epoch Position File next_position next_file
237 Show that we have no epochs in the Binlog
238 include/show_binlog_events.inc
239 Log_name Pos Event_type Server_id End_log_pos Info
240 Disable
241 set global ndb_log_empty_epochs=0;