1
1
-- source include/have_multi_ndb.inc
2
2
-- source include/have_binlog_format_mixed_or_row.inc
3
- # We are using some debug-only features in this test
3
+ # Test is using some debug-only features
4
4
--source include/have_debug.inc
5
5
# Test terminates mysqld which causes valgrind warnings
6
6
--source include/not_valgrind.inc
7
7
# Ignore any mysqld failure reporting
8
8
--source include/not_crashrep.inc
9
9
10
- connection server1;
11
- # Find NodeId of the mysqld we are connected to:
12
- --let $node_id= `SHOW STATUS LIKE 'Ndb_cluster_node_id'`
13
- --let $node_id= `SELECT SUBSTRING('$node_id', 20)+0`
10
+ --connection server1
14
11
--disable_query_log
15
12
call mtr.add_suppression("cluster disconnect An incident event");
16
13
--enable_query_log
17
14
18
- connection server2;
19
- # Find NodeId2 of 'server2' we are connected to:
20
- --let $node_id2= `SHOW STATUS LIKE 'Ndb_cluster_node_id'`
21
- --let $node_id2= `SELECT SUBSTRING('$node_id2', 20)+0`
22
-
23
- # Ignore server shutdown/startup failure
15
+ --connection server2
16
+ # Ignore server shutdown/startup errors in log
24
17
--disable_query_log
25
18
call mtr.add_suppression("Failed to setup binlog");
26
19
call mtr.add_suppression("Distribution of CREATE TABLE");
27
20
call mtr.add_suppression("Server shutdown in progress");
28
21
call mtr.add_suppression("cluster disconnect An incident event");
29
- call mtr.add_suppression("Failed setting up binlogging");
30
22
call mtr.add_suppression("mysqld startup an incident event");
31
- call mtr.add_suppression("Failed to release global schema lock");
23
+ # Reported when the --ndb-log-fail-terminate logic kicks in
24
+ call mtr.add_suppression("Requesting server shutdown");
32
25
--enable_query_log
33
26
34
- #
35
- # 1 create a table
36
- # 2 Setup error insert on MySQLD2
37
- # 3 Disconnect MySQLD2 using DUMP code, causing Binlog re-init
38
- # 4 Observe MySQLD2 fail, then restart (and succeed)
39
- #
40
-
41
- connection server1;
42
- use test;
27
+ --echo # First test, check behaviour with --ndb-log-fail-terminate=1
28
+ --echo # during metadata synchronization
29
+ --echo # - Create table
30
+ --echo # - Setup mysqld2 with DBUG error to force "binlog setup" failure
31
+ --echo # - Setup mtr.pl to expect mysqld2 to shutdown
32
+ --echo # - Use DUMP 900 to disconnect both mysqld's (node 16 and 49)
33
+ --echo # - The mysqld2 will disconnect and then shut itself down when
34
+ --echo # hitting the DBUG error during metadata sync
35
+ --echo # - Start mysqld2 again and check things work
43
36
37
+ --connection server1
44
38
create table t1 (a int primary key) engine=ndb;
45
39
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
46
40
47
- connection server2;
48
- disable_query_log;
49
- let $debug_saved = `select @@global.debug`;
50
- set global debug='-d'; # Switch DEBUG/TRACING OFF
41
+ --connection server2
42
+ --echo # Setup mysqld2 DBUG
43
+ --echo # NOTE! since the process will restart there is no need to save value
51
44
set global debug='+d,ndb_binlog_fail_setup';
52
- enable_query_log;
53
-
54
- --echo Prepare for Server2 to fail
55
- connection server2;
56
- # Find NodeId2 of 'server2' we are connected to:
57
- --let $node_id2= `SHOW STATUS LIKE 'Ndb_cluster_node_id'`
58
- --let $node_id2= `SELECT SUBSTRING('$node_id2', 20)+0`
59
-
60
- #
61
- # Some magic for MTR to allow failure, taken from include/restart_mysqld.inc
62
- #
63
- --let $_server_id= `SELECT @@server_id`
64
- --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.1.expect
65
-
66
- --exec echo "wait" > $_expect_file_name
67
- #
68
- # /end magic part 1
69
- #
70
-
71
- #
72
- # Cause data nodes to disconnect all API nodes
73
- # Each API will setup binlog again
74
- # MySQLD2 will get stuck and restart
75
- #
76
-
77
- --exec $NDB_MGM -e "ALL DUMP 900 $node_id" > $NDB_TOOLS_OUTPUT
78
- --exec $NDB_MGM -e "ALL DUMP 900 $node_id2" > $NDB_TOOLS_OUTPUT
79
-
80
- #connection server1;
81
- #--echo Wait for 'server1' binlog rotate to indicate disconnect
82
- #--let $wait_binlog_event= binlog.000002
83
- #--source include/wait_for_binlog_event.inc
84
-
85
- connection server2;
86
- --echo Wait for 'server2' binlog rotate to indicate disconnect
45
+
46
+ --echo # Write file to make mtr.pl expect mysqld2 shutdown, but don't start
47
+ --echo # until it's told to
48
+ --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.1.expect
49
+ wait
50
+ EOF
51
+
52
+ --echo # Disconnect both mysqld's with DUMP 900
53
+ let $out_file = $MYSQLTEST_VARDIR/tmp/mgm_dump.out;
54
+ --exec $NDB_MGM -e "ALL DUMP 900 16" > $out_file 2>&1
55
+ --exec $NDB_MGM -e "ALL DUMP 900 49" >> $out_file 2>&1
56
+ --remove_file $out_file
57
+
58
+ --echo # Wait for mysqld2 binlog rotate to indicate disconnect
87
59
--let $wait_binlog_event= binlog.000002
88
60
--source include/wait_for_binlog_event.inc
89
61
90
- connection server1;
62
+ --connection server1
63
+ --echo # Wait for mysqld1 to reconnect and insert data to check it's alive
91
64
--source include/ndb_not_readonly.inc
92
65
insert into t1 values (11);
93
66
94
- --echo Give 'server2' some time to start, and fail, a binlog_setup
95
- sleep 2;
96
-
97
- --echo Wait for Server2 to fail
98
- connection server2;
67
+ --connection server2
68
+ --echo # Wait for mysqld2 to disconnect
99
69
--source include/wait_until_disconnected.inc
70
+ --echo # mysqld2 disconnected
100
71
101
- --echo Server2 failed as expected
102
-
103
- #
104
- # More magic from include/restart_mysqld.inc
105
- #
106
- --exec echo "restart" > $_expect_file_name
72
+ --echo # Write file to make mtr.pl start up mysqld2 again
73
+ --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.1.expect
74
+ restart
75
+ EOF
107
76
77
+ --echo # Wait for mysqld2 to reconnect and insert data to check it's alive
108
78
--enable_reconnect
109
79
--source include/wait_until_connected_again.inc
110
80
--disable_reconnect
111
- #
112
- # /end magic part 2
113
- #
114
81
115
- connection server1;
116
82
insert into t1 values (10);
117
- drop table test.t1;
118
-
119
- connection server2;
120
- --echo Wait for 'server2' to complete setup and get out of read-only mode
121
- --source include/ndb_not_readonly.inc
122
- --remove_file $NDB_TOOLS_OUTPUT
123
-
124
- #
125
- # 1 Setup error insert on MySQLD2
126
- # 2 create a table on MySQLD1
127
- # 3 Observe MySQLD2 fail, then restart (and succeed)
128
- #
129
-
130
- --echo Prepare for Server2 to fail
131
- --connection server2
132
- #
133
- # Some magic for MTR to allow failure, taken from include/restart_mysqld.inc
134
- #
135
- --let $_server_id= `SELECT @@server_id`
136
- --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.1.expect
83
+ drop table t1;
137
84
138
- --exec echo "wait" > $_expect_file_name
139
- #
140
- # /end magic part 1
141
- #
85
+ --echo # Second test, check behaviour with --ndb-log-fail-terminate=1
86
+ --echo # during CREATE TABLE
87
+ --echo # - Setup mysqld2 with DBUG error to force "binlog setup" failure
88
+ --echo # - Setup mtr.pl to expect mysqld2 to shutdown
89
+ --echo # - Create table on mysqld1
90
+ --echo # - mysqld2 will fail during schema distribution and shut itself down
91
+ --echo # - Start mysqld2 again and check things work
142
92
143
93
--connection server2
144
- set global debug='-d'; # Switch DEBUG/TRACING OFF
94
+ --echo # Setup mysqld2 DBUG
95
+ --echo # NOTE! since the process will restart there is no need to save value
145
96
set global debug='+d,ndb_binlog_fail_setup';
146
97
98
+ --echo # Write file to make mtr.pl expect mysqld2 shutdown, but don't start
99
+ --echo # until it's told to
100
+ --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.1.expect
101
+ wait
102
+ EOF
103
+
147
104
--connection server1
148
- use test;
149
- --disable_warnings
105
+ --echo # Create table from mysqld1
150
106
create table t1 (a int primary key) engine=ndb;
151
107
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
152
108
153
- --echo Wait for Server2 to fail
154
109
--connection server2
110
+ --echo # Wait for mysqld2 diconnect
155
111
--source include/wait_until_disconnected.inc
112
+ --echo # mysqld2 disconnected
156
113
157
- --echo Server2 failed as expected
158
- --enable_warnings
159
-
160
- #
161
- # More magic from include/restart_mysqld.inc
162
- #
163
- --exec echo "restart" > $_expect_file_name
114
+ --echo # Write file to make mtr.pl start up mysqld2 again
115
+ --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.1.expect
116
+ restart
117
+ EOF
164
118
119
+ --echo # Wait for mysqld2 to reconnect and insert data to check it's alive
165
120
--enable_reconnect
166
121
--source include/wait_until_connected_again.inc
167
122
--disable_reconnect
168
- #
169
- # /end magic part 2
170
- #
171
123
172
124
--source include/ndb_not_readonly.inc
173
125
insert into t1 values (10);
@@ -177,8 +129,3 @@ insert into t1 values (10);
177
129
insert into t1 values (11);
178
130
drop table t1;
179
131
180
- --connection server2
181
- disable_query_log;
182
- set global debug='+d'; # Switch DEBUG/TRACING ON
183
- eval set global debug= '$debug_saved';
184
- enable_query_log;
0 commit comments