Debian Codegraph @

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

raw
1 -- source include/have_multi_ndb.inc
2 -- source include/have_binlog_format_mixed_or_row.inc
3 # Test is using some debug-only features
4 --source include/have_debug.inc
5 # Test terminates mysqld which causes valgrind warnings
6 --source include/not_valgrind.inc
7 # Ignore any mysqld failure reporting
8 --source include/not_crashrep.inc
9
10 --connection server1
11 --disable_query_log
12 call mtr.add_suppression("cluster disconnect An incident event");
13 --enable_query_log
14
15 --connection server2
16 # Ignore server shutdown/startup errors in log
17 --disable_query_log
18 call mtr.add_suppression("Failed to setup binlog");
19 call mtr.add_suppression("Distribution of CREATE TABLE");
20 call mtr.add_suppression("Server shutdown in progress");
21 call mtr.add_suppression("cluster disconnect An incident event");
22 call mtr.add_suppression("mysqld startup an incident event");
23 # Reported when the --ndb-log-fail-terminate logic kicks in
24 call mtr.add_suppression("Requesting server shutdown");
25 --enable_query_log
26
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
36
37 --connection server1
38 create table t1 (a int primary key) engine=ndb;
39 insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
40
41 --connection server2
42 --echo # Setup mysqld2 DBUG
43 --echo # NOTE! since the process will restart there is no need to save value
44 set global debug='+d,ndb_binlog_fail_setup';
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
59 --let $wait_binlog_event= binlog.000002
60 --source include/wait_for_binlog_event.inc
61
62 --connection server1
63 --echo # Wait for mysqld1 to reconnect and insert data to check it's alive
64 --source include/ndb_not_readonly.inc
65 insert into t1 values (11);
66
67 --connection server2
68 --echo # Wait for mysqld2 to disconnect
69 --source include/wait_until_disconnected.inc
70 --echo # mysqld2 disconnected
71
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
76
77 --echo # Wait for mysqld2 to reconnect and insert data to check it's alive
78 --enable_reconnect
79 --source include/wait_until_connected_again.inc
80 --disable_reconnect
81
82 insert into t1 values (10);
83 drop table t1;
84
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
92
93 --connection server2
94 --echo # Setup mysqld2 DBUG
95 --echo # NOTE! since the process will restart there is no need to save value
96 set global debug='+d,ndb_binlog_fail_setup';
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
104 --connection server1
105 --echo # Create table from mysqld1
106 create table t1 (a int primary key) engine=ndb;
107 insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
108
109 --connection server2
110 --echo # Wait for mysqld2 diconnect
111 --source include/wait_until_disconnected.inc
112 --echo # mysqld2 disconnected
113
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
118
119 --echo # Wait for mysqld2 to reconnect and insert data to check it's alive
120 --enable_reconnect
121 --source include/wait_until_connected_again.inc
122 --disable_reconnect
123
124 --source include/ndb_not_readonly.inc
125 insert into t1 values (10);
126
127 --connection server1
128 --source include/ndb_not_readonly.inc
129 insert into t1 values (11);
130 drop table t1;
131
132 #
133 # Check if binlog prints error message to mysql log
134 # When it losses connection to NDB during binlog setup
135 #
136
137 set GLOBAL debug="+d,ndb_binlog_fail_setup_util_table";
138
139 # Restart cluster nodes
140 let $out_file = $MYSQLTEST_VARDIR/tmp/mgm_dump.out;
141 --exec $NDB_MGM -e "all restart" >> $out_file
142 # Wait for all nodes to enter "started"
143 --exec $NDB_WAITER >> $out_file
144 --remove_file $out_file
145
146 #
147 # Wait until the connection to the
148 # cluster has been restored
149 #
150 --source include/ndb_not_readonly.inc
151
152 #check if there are any error message in the server log
153 --let $assert_file=$MYSQLTEST_VARDIR/log/mysqld.1.1.err
154 --let $assert_text=No error log printed when binlog setup fails
155 --let $assert_select=Failed to setup binlogging for table
156 --let $assert_count=0
157 --source include/assert_grep.inc
158 set GLOBAL debug="-d,ndb_binlog_fail_setup_util_table";