Debian Codegraph @

mysql-test/suite/ndb/t/ndb_truncate_nologging.test

raw
1 -- source include/have_ndb.inc
2 -- source include/have_log_bin.inc
3
4 connect (server1,127.0.0.1,root,,test,$MYSQLD1_PORT,);
5 connect (server2,127.0.0.1,root,,test,$MYSQLD2_PORT,);
6
7 --echo Check that server2 is not writing binlog
8 connection server2;
9 -- source include/not_log_bin.inc
10 # Since this server is intentionally running without log-bin, supress warning
11 -- disable_query_log ONCE
12 call mtr.add_suppression("You need to use --log-bin to make --binlog-format work");
13
14 connection server1;
15
16 #
17 # Bug #14845851 MYSQL CLUSTER - AUTO INCREMENT NOT RESET WHEN TRUNCATE NON-BINLOGGING SQL NODES
18 #
19 CREATE TABLE t1 (
20 a bigint unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
21 b int unsigned not null,
22 c int unsigned
23 ) engine=ndbcluster;
24
25
26 --echo insert records into table on server1
27 let $1=500;
28 disable_query_log;
29 while ($1>250)
30 {
31 eval insert into t1 values
32 (NULL, $1+9, 5*$1),
33 (NULL, $1+10, 7),
34 (NULL, $1+10, 7*$1),
35 (NULL, $1+10, 10+$1),
36 (NULL, $1+10, 70*$1),
37 (NULL, $1+10, 7),
38 (NULL, $1+10, 9),
39 (NULL, $1+299, 899),
40 (NULL, $1+10, 12),
41 (NULL, $1+10, 14*$1);
42 dec $1;
43 }
44 enable_query_log;
45
46 --echo insert records into table on server2 to get cached auto_increment values
47 connection server2;
48 let $1=250;
49 disable_query_log;
50 while ($1)
51 {
52 eval insert into t1 values
53 (NULL, $1+9, 5*$1),
54 (NULL, $1+10, 7),
55 (NULL, $1+10, 7*$1),
56 (NULL, $1+10, 10+$1),
57 (NULL, $1+10, 70*$1),
58 (NULL, $1+10, 7),
59 (NULL, $1+10, 9),
60 (NULL, $1+299, 899),
61 (NULL, $1+10, 12),
62 (NULL, $1+10, 14*$1);
63 dec $1;
64 }
65 enable_query_log;
66
67 --echo Check that auto_increment values are correctly generated
68 connection server1;
69
70 select count(*) from t1;
71
72 select * from t1 order by a limit 2;
73
74 truncate table t1;
75
76 --echo Check that server2 has properly reset the cached auto_increment values
77 connection server2;
78
79 select count(*) from t1;
80
81 insert into t1 values(NULL,1,1),(NULL,2,2);
82
83 select * from t1 order by a;
84
85 drop table t1;
86