File: ndb_autodiscover3.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (124 lines) | stat: -rw-r--r-- 3,885 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
-- source include/have_multi_ndb.inc
-- source suite/ndb/include/backup_restore_setup.inc

--connection server1
# Ignore the warning generated by ndbcluster's binlog thread
# when cluster is restarted
--disable_query_log ONCE
call mtr.add_suppression("cluster disconnect An incident event has been written");

--connection server2
# Ignore the warning generated by ndbcluster's binlog thread
# when cluster is restarted - also on the second mysqld
--disable_query_log ONCE
call mtr.add_suppression("cluster disconnect An incident event has been written");

connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (con2,127.0.0.1,root,,test,$MASTER_MYPORT1,);

#
# Transaction ongoing while cluster is restarted
#
--connection server1
create table t1 (a int key) engine=ndbcluster;

begin;
insert into t1 values (1);

--exec $NDB_MGM -e "all restart" >> $NDB_TOOLS_OUTPUT
--exec $NDB_WAITER >> $NDB_TOOLS_OUTPUT

# Wait for mysqld to reconnect and exit from readonly mode
--connection con1
--source include/ndb_not_readonly.inc
# wait for server1 stats thread to re-initialize
--source suite/ndb/include/ndb_index_stat_wait.inc

--connection con2
--source include/ndb_not_readonly.inc
# wait for server2 stats thread to re-initialize
--source suite/ndb/include/ndb_index_stat_wait.inc

--connection server1
--error 1297
insert into t1 values (2);
rollback;

drop table t1;

#
# Stale cache after restart -i
#
--connection server1
create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster;
insert into t2
  values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);
select * from t2 order by a limit 3;

--source include/ndb_backup_id.inc
--exec $NDB_MGM -e "all restart -i" >> $NDB_TOOLS_OUTPUT
--exec $NDB_WAITER >> $NDB_TOOLS_OUTPUT
# now make a backup with explicit id to restore the backup id after initial start
--inc $the_backup_id
--exec $NDB_MGM -e "start backup $the_backup_id" >> $NDB_TOOLS_OUTPUT
# to ensure mysqld has connected again, and recreated system tables

--connection con1
--source include/ndb_not_readonly.inc
# wait for server1 stats thread to re-initialize
--source suite/ndb/include/ndb_index_stat_wait.inc

--connection con2
--source include/ndb_not_readonly.inc
# wait for server2 stats thread to re-initialize
--source suite/ndb/include/ndb_index_stat_wait.inc

--connection server2
--error ER_NO_SUCH_TABLE
select * from t2;
show tables like 't2';
reset master;
create table t2 (a int key) engine=ndbcluster;
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t2 order by a limit 3;

# server 1 should have a stale cache, transaction must be retried
--connection server1
select * from t2 order by a limit 3;
reset master;

--source include/ndb_backup_id.inc
--exec $NDB_MGM -e "all restart -i" >> $NDB_TOOLS_OUTPUT
--exec $NDB_WAITER >> $NDB_TOOLS_OUTPUT
# now make a backup with explicit id to restore the backup id after initial start
--inc $the_backup_id
--exec $NDB_MGM -e "start backup $the_backup_id" >> $NDB_TOOLS_OUTPUT
# to ensure mysqld has connected again, and recreated system tables

--connection con1
--source include/ndb_not_readonly.inc
# wait for server1 stats thread to re-initialize
--source suite/ndb/include/ndb_index_stat_wait.inc

--connection con2
--source include/ndb_not_readonly.inc
# wait for server2 stats thread to re-initialize
--source suite/ndb/include/ndb_index_stat_wait.inc

--connection server1
--error ER_NO_SUCH_TABLE
select * from t2;
show tables like 't2';
reset master;
create table t2 (a int key) engine=ndbcluster;
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t2 order by a limit 3;

# server 2 should have a stale cache, transaction need not be retried
--connection server2
select * from t2 order by a limit 3;
reset master;

drop table t2;
--source suite/ndb/include/backup_restore_cleanup.inc
--remove_file $NDB_TOOLS_OUTPUT