1--source include/have_multi_ndb.inc
2--source include/have_binlog_format_mixed_or_row.inc
3--echo # We are using some debug-only features in this test
4--source include/have_debug.inc
5--source include/not_windows.inc
6
7--echo Explore some event weirdness
8
9--let $SHOW_DETAIL=0
10
11connection server1;
12use test;
13
14create table test.synch(x int primary key auto_increment) engine=ndb;
15
16--disable_result_log
17show create table test.synch;
18--enable_result_log
19reset master;
20
21--echo Create table with tableId X and blob part tables :
22--echo   NDB\$BLOB_X_2
23--echo   NDB\$BLOB_X_3
24--echo   NDB\$BLOB_X_4
25--echo Event will also be created
26--echo   REPL\$test/t1
27--echo Plus
28--echo   NDB\$BLOBEVENT_REPL\$test/t1_2
29--echo   NDB\$BLOBEVENT_REPL\$test/t1_3
30--echo   NDB\$BLOBEVENT_REPL\$test/t1_4
31
32connection server1;
33create table test.t1 (a int primary key, b text, c text, d text) engine=ndb;
34
35insert into test.t1 values(0, "b", "c", "d");
36
37connection server1;
38--disable_query_log
39--disable_result_log
40insert into test.synch values (null);
41--enable_result_log
42--enable_query_log
43
44# Wait for epoch boundary
45--disable_query_log
46--disable_result_log
47show binlog events;
48--enable_result_log
49--enable_query_log
50
51--disable_query_log
52let $MYSQLD_DATADIR= `select @@datadir;`;
53--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
54
55create table raw_binlog_rows (txt varchar(1000));
56
57--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
58
59--echo "Check that the binlog contains the inserted row"
60select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
61drop table raw_binlog_rows;
62--enable_query_log
63reset master;
64
65connection server2;
66--disable_query_log
67--disable_result_log
68insert into test.synch values (null);
69--enable_result_log
70--enable_query_log
71
72# Wait for epoch boundary
73--disable_query_log
74--disable_result_log
75show binlog events;
76--enable_result_log
77--enable_query_log
78
79--disable_query_log
80let $MYSQLD_DATADIR= `select @@datadir;`;
81--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
82
83create table raw_binlog_rows (txt varchar(1000));
84
85--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
86
87--echo "Check that the binlog contains the inserted row"
88select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
89drop table raw_binlog_rows;
90--enable_query_log
91reset master;
92
93--echo Show tables and events
94
95if ($SHOW_DETAIL)
96{
97  --exec $NDB_SHOW_TABLES -p --no-defaults -t2
98  --exec echo Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
99  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
100}
101--echo Expecting 3 BLOB events for t1
102--source ndb_binlog_count_event_t1.inc
103
104--echo Drop table, and show tables and events gone
105
106drop table test.t1;
107
108if ($SHOW_DETAIL)
109{
110  --exec $NDB_SHOW_TABLES --no-defaults -t2
111  --exec echo Expecting 0 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
112  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
113}
114--echo Expecting 0 BLOB events for t1
115--source ndb_binlog_count_event_t1.inc
116
117--echo Recreate the table
118create table test.t1 (a int primary key, b text, c text, d text) engine=ndb;
119
120insert into test.t1 values(0, "b", "c", "d");
121
122connection server1;
123--disable_query_log
124--disable_result_log
125insert into test.synch values (null);
126--enable_result_log
127--enable_query_log
128
129# Wait for epoch boundary
130--disable_query_log
131--disable_result_log
132show binlog events;
133--enable_result_log
134--enable_query_log
135
136--disable_query_log
137let $MYSQLD_DATADIR= `select @@datadir;`;
138--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
139
140create table raw_binlog_rows (txt varchar(1000));
141
142--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
143
144--echo "Check that the binlog contains the inserted row"
145select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
146drop table raw_binlog_rows;
147--enable_query_log
148reset master;
149
150connection server2;
151--disable_query_log
152--disable_result_log
153insert into test.synch values (null);
154--enable_result_log
155--enable_query_log
156
157# Wait for epoch boundary
158--disable_query_log
159--disable_result_log
160show binlog events;
161--enable_result_log
162--enable_query_log
163
164--disable_query_log
165let $MYSQLD_DATADIR= `select @@datadir;`;
166--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
167
168create table raw_binlog_rows (txt varchar(1000));
169
170--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
171
172--echo "Check that the binlog contains the inserted row"
173select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
174drop table raw_binlog_rows;
175--enable_query_log
176reset master;
177
178connection server1;
179
180if ($SHOW_DETAIL)
181{
182  --exec $NDB_SHOW_TABLES --no-defaults -t2
183  --exec echo Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
184  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
185}
186--echo Expecting 3 BLOB events for t1
187--source ndb_binlog_count_event_t1.inc
188
189--echo Drop the table, but fail to drop the event(s)
190set @save_debug = @@global.debug;
191set global debug='-d'; # Switch DEBUG/TRACING OFF
192set global debug='+d,ndb_skip_drop_event';
193
194drop table test.t1;
195show warnings;
196
197--echo Expect : The tables are gone, but their events still hang around
198
199if ($SHOW_DETAIL)
200{
201  --exec $NDB_SHOW_TABLES --no-defaults -t2
202  --exec echo Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
203  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
204}
205--echo Expecting 3 BLOB events for t1
206--source ndb_binlog_count_event_t1.inc
207
208--echo Redo the drop command to clear MySQLD metadata
209--echo Expect an error as the table doesn't exist in Ndb
210--error 1051
211drop table test.t1;
212set global debug='+d'; # Switch DEBUG/TRACING ON
213set global debug=@save_debug;
214
215--echo Expect : The tables are gone, but their events still hang around
216
217if ($SHOW_DETAIL)
218{
219  --exec $NDB_SHOW_TABLES --no-defaults -t2
220  --exec echo Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
221  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
222}
223--echo Expecting 3 BLOB events for t1
224--source ndb_binlog_count_event_t1.inc
225
226--echo ----------------------------------------------------------------------
227--echo Case 1 : Create a table with the same tableId and same number of blobs
228--echo Expect : Creation ok with no errors
229create table test.t1 (a int primary key, b text, c text, d text) engine=ndb;
230show warnings;
231
232insert into test.t1 values(0, "b", "c", "d");
233
234connection server1;
235--disable_query_log
236--disable_result_log
237insert into test.synch values (null);
238--enable_result_log
239--enable_query_log
240
241# Wait for epoch boundary
242--disable_query_log
243--disable_result_log
244show binlog events;
245--enable_result_log
246--enable_query_log
247
248--disable_query_log
249let $MYSQLD_DATADIR= `select @@datadir;`;
250--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
251
252create table raw_binlog_rows (txt varchar(1000));
253
254--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
255
256--echo "Check that the binlog contains the inserted row"
257select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
258drop table raw_binlog_rows;
259--enable_query_log
260reset master;
261
262connection server2;
263--disable_query_log
264--disable_result_log
265insert into test.synch values (null);
266--enable_result_log
267--enable_query_log
268
269# Wait for epoch boundary
270--disable_query_log
271--disable_result_log
272show binlog events;
273--enable_result_log
274--enable_query_log
275
276--disable_query_log
277let $MYSQLD_DATADIR= `select @@datadir;`;
278--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
279
280create table raw_binlog_rows (txt varchar(1000));
281
282--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
283
284--echo "Check that the binlog contains the inserted row"
285select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
286drop table raw_binlog_rows;
287--enable_query_log
288reset master;
289
290connection server1;
291
292if ($SHOW_DETAIL)
293{
294  --exec $NDB_SHOW_TABLES --no-defaults -t2
295  --exec echo Case 1 : Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
296  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
297}
298--echo Expecting 3 BLOB events for t1
299--source ndb_binlog_count_event_t1.inc
300
301--echo Drop the table, but fail to drop the event(s)
302set global debug='-d'; # Switch DEBUG/TRACING OFF
303set global debug='+d,ndb_skip_drop_event';
304
305drop table test.t1;
306show warnings;
307
308--echo Redo the drop command to clear MySQLD metadata
309--echo Expect an error as the table doesn't exist in Ndb
310--error 1051
311drop table test.t1;
312set global debug='+d'; # Switch DEBUG/TRACING ON
313set global debug=@save_debug;
314
315if ($SHOW_DETAIL)
316{
317  --exec $NDB_SHOW_TABLES --no-defaults -t2
318  --exec echo Case 1 : Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
319  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
320}
321--echo Expecting 3 BLOB events for t1
322--source ndb_binlog_count_event_t1.inc
323
324--echo ----------------------------------------------------------------------
325--echo Case 2 : Create a table with the same tableid + name, more blobs
326--echo Expect : No errors, event setup includes one event for each blob column
327
328create table test.t1 (a int primary key, b text, c text, d text, e text) engine=ndb;
329show warnings;
330
331insert into test.t1 values(0, "b", "c", "d", "e");
332
333connection server1;
334--disable_query_log
335--disable_result_log
336insert into test.synch values (null);
337--enable_result_log
338--enable_query_log
339
340# Wait for epoch boundary
341--disable_query_log
342--disable_result_log
343show binlog events;
344--enable_result_log
345--enable_query_log
346
347--disable_query_log
348let $MYSQLD_DATADIR= `select @@datadir;`;
349--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
350
351create table raw_binlog_rows (txt varchar(1000));
352
353--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
354
355--echo "Check that the binlog contains the inserted row"
356select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
357drop table raw_binlog_rows;
358--enable_query_log
359reset master;
360
361connection server2;
362--disable_query_log
363--disable_result_log
364insert into test.synch values (null);
365--enable_result_log
366--enable_query_log
367
368# Wait for epoch boundary
369--disable_query_log
370--disable_result_log
371show binlog events;
372--enable_result_log
373--enable_query_log
374
375--disable_query_log
376let $MYSQLD_DATADIR= `select @@datadir;`;
377--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
378
379create table raw_binlog_rows (txt varchar(1000));
380
381--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
382
383--echo "Check that the binlog contains the inserted row"
384select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
385drop table raw_binlog_rows;
386--enable_query_log
387reset master;
388
389connection server1;
390
391if ($SHOW_DETAIL)
392{
393  --exec $NDB_SHOW_TABLES --no-defaults -t2
394  --exec echo Case 2 : Expecting 4 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
395  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
396}
397--echo Expecting 4 BLOB events for t1
398--source ndb_binlog_count_event_t1.inc
399
400--echo Drop the table, but fail to drop the event(s)
401set global debug='-d'; # Switch DEBUG/TRACING OFF
402set global debug='+d,ndb_skip_drop_event';
403
404drop table test.t1;
405show warnings;
406
407--echo Redo the drop command to clear MySQLD metadata
408--echo Expect an error as the table doesn't exist in Ndb
409--error 1051
410drop table test.t1;
411set global debug='+d'; # Switch DEBUG/TRACING ON
412set global debug=@save_debug;
413
414if ($SHOW_DETAIL)
415{
416  --exec $NDB_SHOW_TABLES --no-defaults -t2
417  --exec echo Case 2 : Expecting 4 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
418  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
419}
420--echo Expecting 4 BLOB events for t1
421--source ndb_binlog_count_event_t1.inc
422
423--echo ----------------------------------------------------------------------
424--echo Case 3 : Create a table with the same tableid + name, fewer blobs
425--echo Expect : No errors, extra blob events dropped
426
427create table test.t1 (a int primary key, b text) engine=ndb;
428show warnings;
429
430insert into test.t1 values(0, "b");
431
432connection server1;
433--disable_query_log
434--disable_result_log
435insert into test.synch values (null);
436--enable_result_log
437--enable_query_log
438
439# Wait for epoch boundary
440--disable_query_log
441--disable_result_log
442show binlog events;
443--enable_result_log
444--enable_query_log
445
446--disable_query_log
447let $MYSQLD_DATADIR= `select @@datadir;`;
448--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
449
450create table raw_binlog_rows (txt varchar(1000));
451
452--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
453
454--echo "Check that the binlog contains the inserted row"
455select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
456drop table raw_binlog_rows;
457--enable_query_log
458reset master;
459
460connection server2;
461--disable_query_log
462--disable_result_log
463insert into test.synch values (null);
464--enable_result_log
465--enable_query_log
466
467# Wait for epoch boundary
468--disable_query_log
469--disable_result_log
470show binlog events;
471--enable_result_log
472--enable_query_log
473
474--disable_query_log
475let $MYSQLD_DATADIR= `select @@datadir;`;
476--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
477
478create table raw_binlog_rows (txt varchar(1000));
479
480--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
481
482--echo "Check that the binlog contains the inserted row"
483select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
484drop table raw_binlog_rows;
485--enable_query_log
486reset master;
487
488connection server1;
489
490if ($SHOW_DETAIL)
491{
492  --exec $NDB_SHOW_TABLES --no-defaults -t2
493  --exec echo Case 3 : Expecting 1 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
494  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
495}
496--echo Expecting 1 BLOB events for t1
497--source ndb_binlog_count_event_t1.inc
498
499--echo Drop the table, but fail to drop the event(s)
500set global debug='-d'; # Switch DEBUG/TRACING OFF
501set global debug='+d,ndb_skip_drop_event';
502
503drop table test.t1;
504show warnings;
505
506--echo Redo the drop command to clear MySQLD metadata
507--echo Expect an error as the table doesn't exist in Ndb
508--error 1051
509drop table test.t1;
510set global debug='+d'; # Switch DEBUG/TRACING ON
511set global debug=@save_debug;
512
513if ($SHOW_DETAIL)
514{
515  --exec $NDB_SHOW_TABLES --no-defaults -t2
516  --exec echo Case 3 : Expecting 1 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
517  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
518}
519--echo Expecting 1 BLOB events for t1
520--source ndb_binlog_count_event_t1.inc
521
522--echo ----------------------------------------------------------------------
523--echo Case 4 : Create a table with the same tableid + name, different numbered blobs
524--echo Expect : No errors, event for new numbered blob, others gone
525create table test.t1 (a int primary key, b int, c text) engine=ndb;
526show warnings;
527
528insert into test.t1 values(0, 1, "c");
529
530connection server1;
531--disable_query_log
532--disable_result_log
533insert into test.synch values (null);
534--enable_result_log
535--enable_query_log
536
537# Wait for epoch boundary
538--disable_query_log
539--disable_result_log
540show binlog events;
541--enable_result_log
542--enable_query_log
543
544--disable_query_log
545let $MYSQLD_DATADIR= `select @@datadir;`;
546--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
547
548create table raw_binlog_rows (txt varchar(1000));
549
550--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
551
552--echo "Check that the binlog contains the inserted row"
553select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
554drop table raw_binlog_rows;
555--enable_query_log
556reset master;
557
558connection server2;
559--disable_query_log
560--disable_result_log
561insert into test.synch values (null);
562--enable_result_log
563--enable_query_log
564
565# Wait for epoch boundary
566--disable_query_log
567--disable_result_log
568show binlog events;
569--enable_result_log
570--enable_query_log
571
572--disable_query_log
573let $MYSQLD_DATADIR= `select @@datadir;`;
574--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
575
576create table raw_binlog_rows (txt varchar(1000));
577
578--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
579
580--echo "Check that the binlog contains the inserted row"
581select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
582drop table raw_binlog_rows;
583--enable_query_log
584reset master;
585
586connection server1;
587
588if ($SHOW_DETAIL)
589{
590  --exec $NDB_SHOW_TABLES --no-defaults -t2
591  --exec echo Case 4 : Expecting 1 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
592  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
593}
594--echo Expecting 1 BLOB events for t1
595--source ndb_binlog_count_event_t1.inc
596
597--echo Drop the table, but fail to drop the event(s)
598set global debug='-d'; # Switch DEBUG/TRACING OFF
599set global debug='+d,ndb_skip_drop_event';
600
601drop table test.t1;
602show warnings;
603
604--echo Redo the drop command to clear MySQLD metadata
605--echo Expect an error as the table doesn't exist in Ndb
606--error 1051
607drop table test.t1;
608set global debug='+d'; # Switch DEBUG/TRACING ON
609set global debug=@save_debug;
610
611--echo Cleanup table in cluster
612--echo Expect : All t1 related events and tables gone
613create table test.t1 (a int primary key, b text) engine=ndb;
614
615insert into test.t1 values(0, "b");
616
617connection server1;
618--disable_query_log
619--disable_result_log
620insert into test.synch values (null);
621--enable_result_log
622--enable_query_log
623
624# Wait for epoch boundary
625--disable_query_log
626--disable_result_log
627show binlog events;
628--enable_result_log
629--enable_query_log
630
631--disable_query_log
632let $MYSQLD_DATADIR= `select @@datadir;`;
633--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
634
635create table raw_binlog_rows (txt varchar(1000));
636
637--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
638
639--echo "Check that the binlog contains the inserted row"
640select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
641drop table raw_binlog_rows;
642--enable_query_log
643reset master;
644
645connection server2;
646--disable_query_log
647--disable_result_log
648insert into test.synch values (null);
649--enable_result_log
650--enable_query_log
651
652# Wait for epoch boundary
653--disable_query_log
654--disable_result_log
655show binlog events;
656--enable_result_log
657--enable_query_log
658
659--disable_query_log
660let $MYSQLD_DATADIR= `select @@datadir;`;
661--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
662
663create table raw_binlog_rows (txt varchar(1000));
664
665--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
666
667--echo "Check that the binlog contains the inserted row"
668select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
669drop table raw_binlog_rows;
670--enable_query_log
671reset master;
672
673connection server1;
674
675drop table test.t1;
676
677if ($SHOW_DETAIL)
678{
679  --exec $NDB_SHOW_TABLES --no-defaults -t2
680  --exec echo Case 4 : Expecting 0 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
681  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
682}
683--echo Expecting 0 BLOB events for t1
684--source ndb_binlog_count_event_t1.inc
685
686--echo Create table with 3 blob columns
687create table test.t1 (a int primary key, b text, c text, d text) engine=ndb;
688
689insert into test.t1 values(0, "b", "c", "d");
690
691connection server1;
692--disable_query_log
693--disable_result_log
694insert into test.synch values (null);
695--enable_result_log
696--enable_query_log
697
698# Wait for epoch boundary
699--disable_query_log
700--disable_result_log
701show binlog events;
702--enable_result_log
703--enable_query_log
704
705--disable_query_log
706let $MYSQLD_DATADIR= `select @@datadir;`;
707--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
708
709create table raw_binlog_rows (txt varchar(1000));
710
711--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
712
713--echo "Check that the binlog contains the inserted row"
714select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
715drop table raw_binlog_rows;
716--enable_query_log
717reset master;
718
719connection server2;
720--disable_query_log
721--disable_result_log
722insert into test.synch values (null);
723--enable_result_log
724--enable_query_log
725
726# Wait for epoch boundary
727--disable_query_log
728--disable_result_log
729show binlog events;
730--enable_result_log
731--enable_query_log
732
733--disable_query_log
734let $MYSQLD_DATADIR= `select @@datadir;`;
735--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
736
737create table raw_binlog_rows (txt varchar(1000));
738
739--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
740
741--echo "Check that the binlog contains the inserted row"
742select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
743drop table raw_binlog_rows;
744--enable_query_log
745reset master;
746
747connection server1;
748
749if ($SHOW_DETAIL)
750{
751  --exec $NDB_SHOW_TABLES --no-defaults -t2
752  --exec echo Case 4 : Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
753  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
754}
755--echo Expecting 3 BLOB events for t1
756--source ndb_binlog_count_event_t1.inc
757
758--echo And drop without dropping events...
759set global debug='-d'; # Switch DEBUG/TRACING OFF
760set global debug='+d,ndb_skip_drop_event';
761
762drop table test.t1;
763show warnings;
764
765--echo Redo the drop command to clear MySQLD metadata
766--echo Expect an error as the table doesn't exist in Ndb
767--error 1051
768drop table test.t1;
769set global debug='+d'; # Switch DEBUG/TRACING ON
770set global debug=@save_debug;
771
772if ($SHOW_DETAIL)
773{
774  --exec $NDB_SHOW_TABLES --no-defaults -t2
775  --exec echo Case 4 : Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
776  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
777}
778--echo Expecting 3 BLOB events for t1
779--source ndb_binlog_count_event_t1.inc
780
781--echo ----------------------------------------------------------------------
782--echo Case 5 : Create a table with same name, different tableid, same blobs
783--echo Expect : No errors, all blobs have events referring to their parts tables
784
785--echo Create a filler table to shift-up tableids
786create table test.filler1(a int) engine=ndb;
787
788create table test.t1 (a int primary key, b text, c text, d text) engine=ndb;
789show warnings;
790
791insert into test.t1 values(0, "b", "c", "d");
792
793connection server1;
794--disable_query_log
795--disable_result_log
796insert into test.synch values (null);
797--enable_result_log
798--enable_query_log
799
800# Wait for epoch boundary
801--disable_query_log
802--disable_result_log
803show binlog events;
804--enable_result_log
805--enable_query_log
806
807--disable_query_log
808let $MYSQLD_DATADIR= `select @@datadir;`;
809--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
810
811create table raw_binlog_rows (txt varchar(1000));
812
813--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
814
815--echo "Check that the binlog contains the inserted row"
816select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
817drop table raw_binlog_rows;
818--enable_query_log
819reset master;
820
821connection server2;
822--disable_query_log
823--disable_result_log
824insert into test.synch values (null);
825--enable_result_log
826--enable_query_log
827
828# Wait for epoch boundary
829--disable_query_log
830--disable_result_log
831show binlog events;
832--enable_result_log
833--enable_query_log
834
835--disable_query_log
836let $MYSQLD_DATADIR= `select @@datadir;`;
837--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
838
839create table raw_binlog_rows (txt varchar(1000));
840
841--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
842
843--echo "Check that the binlog contains the inserted row"
844select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
845drop table raw_binlog_rows;
846--enable_query_log
847reset master;
848
849connection server1;
850
851if ($SHOW_DETAIL)
852{
853  --exec $NDB_SHOW_TABLES --no-defaults -t2
854  --exec echo Case 5 : Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
855  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
856}
857--echo Expecting 3 BLOB events for t1
858--source ndb_binlog_count_event_t1.inc
859
860--echo Drop table and recreate to get normal setup
861--echo Expect : Table creates without warnings and all events are as expected
862drop table test.t1;
863create table test.t1 (a int primary key, b text, c text, d text) engine=ndb;
864show warnings;
865
866insert into test.t1 values(0, "b", "c", "d");
867
868connection server1;
869--disable_query_log
870--disable_result_log
871insert into test.synch values (null);
872--enable_result_log
873--enable_query_log
874
875# Wait for epoch boundary
876--disable_query_log
877--disable_result_log
878show binlog events;
879--enable_result_log
880--enable_query_log
881
882--disable_query_log
883let $MYSQLD_DATADIR= `select @@datadir;`;
884--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
885
886create table raw_binlog_rows (txt varchar(1000));
887
888--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
889
890--echo "Check that the binlog contains the inserted row"
891select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
892drop table raw_binlog_rows;
893--enable_query_log
894reset master;
895
896connection server2;
897--disable_query_log
898--disable_result_log
899insert into test.synch values (null);
900--enable_result_log
901--enable_query_log
902
903# Wait for epoch boundary
904--disable_query_log
905--disable_result_log
906show binlog events;
907--enable_result_log
908--enable_query_log
909
910--disable_query_log
911let $MYSQLD_DATADIR= `select @@datadir;`;
912--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
913
914create table raw_binlog_rows (txt varchar(1000));
915
916--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
917
918--echo "Check that the binlog contains the inserted row"
919select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
920drop table raw_binlog_rows;
921--enable_query_log
922reset master;
923
924connection server1;
925
926if ($SHOW_DETAIL)
927{
928  --exec $NDB_SHOW_TABLES --no-defaults -t2
929  --exec echo Case 5 : Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
930  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
931}
932--echo Expecting 3 BLOB events for t1
933--source ndb_binlog_count_event_t1.inc
934
935--echo And drop without dropping events...
936set global debug='-d'; # Switch DEBUG/TRACING OFF
937set global debug='+d,ndb_skip_drop_event';
938
939drop table test.t1;
940show warnings;
941
942--echo Redo the drop command to clear MySQLD metadata
943--echo Expect an error as the table doesn't exist in Ndb
944--error 1051
945drop table test.t1;
946set global debug='+d'; # Switch DEBUG/TRACING ON
947set global debug=@save_debug;
948
949if ($SHOW_DETAIL)
950{
951  --exec $NDB_SHOW_TABLES --no-defaults -t2
952  --exec echo Case 5 : Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
953  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
954}
955--echo Expecting 3 BLOB events for t1
956--source ndb_binlog_count_event_t1.inc
957
958--echo ----------------------------------------------------------------------
959--echo Case 6 : Same name, different tableid, different numbered blobs
960--echo Drop filler table to shift tableids
961drop table test.filler1;
962
963create table test.t1 (a int primary key, spacer int, b text, c text, d text) engine=ndb;
964show warnings;
965
966insert into test.t1 values(0, 1, "b", "c", "d");
967
968connection server1;
969--disable_query_log
970--disable_result_log
971insert into test.synch values (null);
972--enable_result_log
973--enable_query_log
974
975# Wait for epoch boundary
976--disable_query_log
977--disable_result_log
978show binlog events;
979--enable_result_log
980--enable_query_log
981
982--disable_query_log
983let $MYSQLD_DATADIR= `select @@datadir;`;
984--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
985
986create table raw_binlog_rows (txt varchar(1000));
987
988--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
989
990--echo "Check that the binlog contains the inserted row"
991select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
992drop table raw_binlog_rows;
993--enable_query_log
994reset master;
995
996connection server2;
997--disable_query_log
998--disable_result_log
999insert into test.synch values (null);
1000--enable_result_log
1001--enable_query_log
1002
1003# Wait for epoch boundary
1004--disable_query_log
1005--disable_result_log
1006show binlog events;
1007--enable_result_log
1008--enable_query_log
1009
1010--disable_query_log
1011let $MYSQLD_DATADIR= `select @@datadir;`;
1012--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
1013
1014create table raw_binlog_rows (txt varchar(1000));
1015
1016--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
1017
1018--echo "Check that the binlog contains the inserted row"
1019select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
1020drop table raw_binlog_rows;
1021--enable_query_log
1022reset master;
1023
1024connection server1;
1025
1026if ($SHOW_DETAIL)
1027{
1028  --exec $NDB_SHOW_TABLES --no-defaults -t2
1029  --exec echo Case 6 : Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
1030  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
1031}
1032--echo Expecting 3 BLOB events for t1
1033--source ndb_binlog_count_event_t1.inc
1034
1035--echo And drop without dropping events...
1036set global debug='-d'; # Switch DEBUG/TRACING OFF
1037set global debug='+d,ndb_skip_drop_event';
1038
1039drop table test.t1;
1040show warnings;
1041
1042--echo Redo the drop command to clear MySQLD metadata
1043--echo Expect an error as the table doesn't exist in Ndb
1044--error 1051
1045drop table test.t1;
1046set global debug='+d'; # Switch DEBUG/TRACING ON
1047set global debug=@save_debug;
1048
1049if ($SHOW_DETAIL)
1050{
1051  --exec $NDB_SHOW_TABLES --no-defaults -t2
1052  --exec echo Case 5 : Expecting 3 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
1053  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
1054}
1055--echo Expecting 3 BLOB events for t1
1056--source ndb_binlog_count_event_t1.inc
1057
1058--echo ----------------------------------------------------------------------
1059--echo Case 7 : Create a table with the same tableid + name, no blobs
1060--echo Expect : No errors, all blob events gone, currently fail
1061
1062create table test.t1 (a int primary key, b varchar(2), c varchar(2), d varchar(2), e varchar(2)) engine=ndb;
1063show warnings;
1064
1065insert into test.t1 values(0, "b", "c", "d", "e");
1066
1067connection server1;
1068--disable_query_log
1069--disable_result_log
1070insert into test.synch values (null);
1071--enable_result_log
1072--enable_query_log
1073
1074# Wait for epoch boundary
1075--disable_query_log
1076--disable_result_log
1077show binlog events;
1078--enable_result_log
1079--enable_query_log
1080
1081--disable_query_log
1082let $MYSQLD_DATADIR= `select @@datadir;`;
1083--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
1084
1085create table raw_binlog_rows (txt varchar(1000));
1086
1087--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
1088
1089--echo "Check that the binlog contains the inserted row"
1090select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
1091drop table raw_binlog_rows;
1092--enable_query_log
1093reset master;
1094
1095connection server2;
1096--disable_query_log
1097--disable_result_log
1098insert into test.synch values (null);
1099--enable_result_log
1100--enable_query_log
1101
1102# Wait for epoch boundary
1103--disable_query_log
1104--disable_result_log
1105show binlog events;
1106--enable_result_log
1107--enable_query_log
1108
1109--disable_query_log
1110let $MYSQLD_DATADIR= `select @@datadir;`;
1111--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
1112
1113create table raw_binlog_rows (txt varchar(1000));
1114
1115--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
1116
1117--echo "Check that the binlog contains the inserted row"
1118select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
1119drop table raw_binlog_rows;
1120--enable_query_log
1121reset master;
1122
1123connection server1;
1124
1125if ($SHOW_DETAIL)
1126{
1127  --exec $NDB_SHOW_TABLES --no-defaults -t2
1128  --exec echo Case 7 : Expecting 0 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
1129  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
1130}
1131--echo Expecting 0 BLOB events for t1 (TODO clean up BLOB events always)
1132--source ndb_binlog_count_event_t1.inc
1133
1134--echo Drop the table, but fail to drop any event(s)
1135set global debug='-d'; # Switch DEBUG/TRACING OFF
1136set global debug='+d,ndb_skip_drop_event';
1137
1138drop table test.t1;
1139show warnings;
1140
1141--echo Redo the drop command to clear MySQLD metadata
1142--echo Expect an error as the table doesn't exist in Ndb
1143--error 1051
1144drop table test.t1;
1145set global debug='+d'; # Switch DEBUG/TRACING ON
1146set global debug=@save_debug;
1147
1148if ($SHOW_DETAIL)
1149{
1150  --exec $NDB_SHOW_TABLES --no-defaults -t2
1151  --exec echo Case 7 : Expecting 0 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
1152  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
1153}
1154--echo Expecting 0 BLOB events for t1 (TODO clean up BLOB events always)
1155--source ndb_binlog_count_event_t1.inc
1156
1157--echo ----------------------------------------------------------------------
1158--echo Case 8 : Create a table with the same tableid + name, blobs when previously no blobs
1159--echo Expect : No errors, event setup includes one event for each blob column
1160
1161create table test.t1 (a int primary key, b text, c text, d text, e text) engine=ndb;
1162show warnings;
1163
1164insert into test.t1 values(0, "b", "c", "d", "e");
1165
1166connection server1;
1167--disable_query_log
1168--disable_result_log
1169insert into test.synch values (null);
1170--enable_result_log
1171--enable_query_log
1172
1173# Wait for epoch boundary
1174--disable_query_log
1175--disable_result_log
1176show binlog events;
1177--enable_result_log
1178--enable_query_log
1179
1180--disable_query_log
1181let $MYSQLD_DATADIR= `select @@datadir;`;
1182--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
1183
1184create table raw_binlog_rows (txt varchar(1000));
1185
1186--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
1187
1188--echo "Check that the binlog contains the inserted row"
1189select distinct "mysqld1:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
1190drop table raw_binlog_rows;
1191--enable_query_log
1192reset master;
1193
1194connection server2;
1195--disable_query_log
1196--disable_result_log
1197insert into test.synch values (null);
1198--enable_result_log
1199--enable_query_log
1200
1201# Wait for epoch boundary
1202--disable_query_log
1203--disable_result_log
1204show binlog events;
1205--enable_result_log
1206--enable_query_log
1207
1208--disable_query_log
1209let $MYSQLD_DATADIR= `select @@datadir;`;
1210--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
1211
1212create table raw_binlog_rows (txt varchar(1000));
1213
1214--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
1215
1216--echo "Check that the binlog contains the inserted row"
1217select distinct "mysqld2:",txt from raw_binlog_rows where txt like "### % `test`.`t1`" or txt like "### %='b'" or txt like "### %='c'" or txt like "### %='d'" or txt like "### %='e'";
1218drop table raw_binlog_rows;
1219--enable_query_log
1220reset master;
1221
1222connection server1;
1223
1224if ($SHOW_DETAIL)
1225{
1226  --exec $NDB_SHOW_TABLES --no-defaults -t2
1227  --exec echo Case 8 : Expecting 4 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
1228  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
1229}
1230--echo Expecting 4 BLOB events for t1
1231--source ndb_binlog_count_event_t1.inc
1232
1233# Cases :
1234# 1: Same name
1235# 2: Same name, same tableid, more blobs
1236# 3: Same name, same tableid, fewer blobs
1237# 4: Same name, same tableid, different numbered blobs
1238# 5: Same name, different tableid, same blobs
1239# 6: Same name, different tableid, different numbered blobs
1240# 7: Same name, same tableid, no blobs when previously blobs
1241# 8: Same name, same tableid, blobs when previously no blobs
1242
1243
1244# Weird 'reuse existing event with name x'
1245# Missing blob event
1246
1247drop table test.t1;
1248
1249if ($SHOW_DETAIL)
1250{
1251  --exec $NDB_SHOW_TABLES --no-defaults -t2
1252  --exec echo Expecting 0 BLOB events for t1 >> $MYSQLTEST_VARDIR/tmp.dat
1253  --exec $NDB_SELECT_ALL --no-defaults -dsys NDB\$EVENTS_0
1254}
1255--echo Expecting 0 BLOB events for t1
1256--source ndb_binlog_count_event_t1.inc
1257
1258drop table test.synch;
1259--remove_file $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql
1260--remove_file $MYSQLTEST_VARDIR/tmp.dat
1261