1
-- source include/have_multi_ndb.inc
2
-- source include/ndb_default_cluster.inc
3
-- source include/not_embedded.inc
6
-- source include/have_binlog_format_mixed_or_row.inc
9
drop table if exists t1, t2;
12
connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,);
13
connect (con2,127.0.0.1,root,,test,$MASTER_MYPORT1,);
15
# Workaround for Bug#27644
16
# ndb: connecting api node/mysqld may "steal" node_id from running mysqld
17
# - let ndb_waiter use a fixed node id so "steal" cannot happen
18
--let connect_str = "nodeid=6;$NDB_CONNECTSTRING"
21
# Transaction ongoing while cluster is restarted
24
create table t1 (a int key) engine=ndbcluster;
27
insert into t1 values (1);
29
--exec $NDB_MGM --no-defaults -e "all restart" >> $NDB_TOOLS_OUTPUT
30
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
31
# Wait for mysqld to reconnect and exit from readonly mode
34
--source include/ndb_not_readonly.inc
36
--source include/ndb_not_readonly.inc
41
insert into t1 values (2);
48
# Stale cache after restart -i
51
create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster;
52
insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);
53
select * from t2 order by a limit 3;
55
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
56
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
57
# to ensure mysqld has connected again, and recreated system tables
60
--source include/ndb_not_readonly.inc
62
--source include/ndb_not_readonly.inc
66
--error ER_NO_SUCH_TABLE
68
show tables like 't2';
70
create table t2 (a int key) engine=ndbcluster;
71
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
72
select * from t2 order by a limit 3;
74
# server 1 should have a stale cache, and in this case wrong frm, transaction must be retried
76
select * from t2 order by a limit 3;
79
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
80
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
81
# to ensure mysqld has connected again, and recreated system tables
84
--source include/ndb_not_readonly.inc
86
--source include/ndb_not_readonly.inc
90
--error ER_NO_SUCH_TABLE
92
show tables like 't2';
94
create table t2 (a int key) engine=ndbcluster;
95
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
96
select * from t2 order by a limit 3;
98
# server 2 should have a stale cache, but with right frm, transaction need not be retried
100
select * from t2 order by a limit 3;