Debian Codegraph @

mysql-test/suite/ndb_binlog/t/ndb_binlog_flush_log_waits.test

raw
1 -- source include/have_ndb.inc
2 -- source include/have_binlog_format_mixed_or_row.inc
3
4 #
5 # Test whether FLUSH LOGS flushes upto
6 # session_last_committed_epoch to Binlog.
7 #
8
9 # Set Binlog size large enough to avoid size-based rotate
10 SET @default_max_binlog_size = @@global.max_binlog_size;
11 set global max_binlog_size=1048576; #1MB
12
13 create table test.tn (b varchar(1000)) engine=ndb;
14
15 # Method to generate load on NDB
16 delimiter %;
17 create procedure create_load(loops int)
18 begin
19 set @x = 0;
20 repeat
21 insert into tn values (repeat('C', 100));
22 insert into tn values (repeat('C', 100));
23 insert into tn values (repeat('C', 100));
24 insert into tn values (repeat('C', 100));
25 insert into tn values (repeat('C', 100));
26 insert into tn values (repeat('C', 100));
27 insert into tn values (repeat('C', 100));
28 insert into tn values (repeat('C', 100));
29 insert into tn values (repeat('C', 100));
30 insert into tn values (repeat('C', 100));
31 delete from tn;
32 set @x = @x + 1;
33 until @x = loops
34 end repeat;
35 end%
36 delimiter ;%
37
38 # Generate much load on NDB in order to make Binlog to lag behind
39 --disable_result_log
40 call create_load(20);
41 --enable_result_log
42
43 # Get the last committed epoch of the session
44 --source ndb_binlog_init_epoch_vals.inc
45 let $session_epoch= query_get_value(select @init_session_epoch as e, e, 1);
46
47 # Flush Binlog
48 FLUSH LOGS;
49
50 # Get the maximum epoch written to Binlog
51 let $max_epoch_after_flush = `select max(epoch) as epoch from
52 mysql.ndb_binlog_index`;
53
54 if ($max_epoch_after_flush < $session_epoch)
55 {
56 --echo
57 --echo Max epoch found in Binlog after FLUSH LOGS ($max_epoch_after_flush)
58 --echo is less than the last committed epoch of the session
59 ($session_epoch)
60 --echo
61 die "FLUSH LOGS failed to flush upto the last committed epoch of the
62 session";
63 }
64
65 drop procedure create_load;
66 drop table tn;
67
68 set global max_binlog_size= @default_max_binlog_size;