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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
-- source include/have_multi_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc
# Test is using some debug-only features
--source include/have_debug.inc
# Test terminates mysqld which causes valgrind warnings
--source include/not_valgrind.inc
# Ignore any mysqld failure reporting
--source include/not_crashrep.inc
--connection server1
--disable_query_log
call mtr.add_suppression("cluster disconnect An incident event");
--enable_query_log
--connection server2
# Ignore server shutdown/startup errors in log
--disable_query_log
call mtr.add_suppression("Failed to setup binlog");
call mtr.add_suppression("Distribution of CREATE TABLE");
call mtr.add_suppression("Server shutdown in progress");
call mtr.add_suppression("cluster disconnect An incident event");
call mtr.add_suppression("mysqld startup an incident event");
# Reported when the --ndb-log-fail-terminate logic kicks in
call mtr.add_suppression("Requesting server shutdown");
--enable_query_log
--echo # First test, check behaviour with --ndb-log-fail-terminate=1
--echo # during metadata synchronization
--echo # - Create table
--echo # - Setup mysqld2 with DBUG error to force "binlog setup" failure
--echo # - Setup mtr.pl to expect mysqld2 to shutdown
--echo # - Use DUMP 900 to disconnect both mysqld's (node 16 and 49)
--echo # - The mysqld2 will disconnect and then shut itself down when
--echo # hitting the DBUG error during metadata sync
--echo # - Start mysqld2 again and check things work
--connection server1
create table t1 (a int primary key) engine=ndb;
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
--connection server2
--echo # Setup mysqld2 DBUG
--echo # NOTE! since the process will restart there is no need to save value
set global debug='+d,ndb_binlog_fail_setup';
--echo # Write file to make mtr.pl expect mysqld2 shutdown, but don't start
--echo # until it's told to
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.1.expect
wait
EOF
--echo # Disconnect both mysqld's with DUMP 900
let $out_file = $MYSQLTEST_VARDIR/tmp/mgm_dump.out;
--exec $NDB_MGM -e "ALL DUMP 900 16" > $out_file 2>&1
--exec $NDB_MGM -e "ALL DUMP 900 49" >> $out_file 2>&1
--remove_file $out_file
--echo # Wait for mysqld2 binlog rotate to indicate disconnect
--let $wait_binlog_event= binlog.000002
--source include/wait_for_binlog_event.inc
--connection server1
--echo # Wait for mysqld1 to reconnect and insert data to check it's alive
--source include/ndb_not_readonly.inc
insert into t1 values (11);
--connection server2
--echo # Wait for mysqld2 to disconnect
--source include/wait_until_disconnected.inc
--echo # mysqld2 disconnected
--echo # Write file to make mtr.pl start up mysqld2 again
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.1.expect
restart
EOF
--echo # Wait for mysqld2 to reconnect and insert data to check it's alive
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
insert into t1 values (10);
drop table t1;
--echo # Second test, check behaviour with --ndb-log-fail-terminate=1
--echo # during CREATE TABLE
--echo # - Setup mysqld2 with DBUG error to force "binlog setup" failure
--echo # - Setup mtr.pl to expect mysqld2 to shutdown
--echo # - Create table on mysqld1
--echo # - mysqld2 will fail during schema distribution and shut itself down
--echo # - Start mysqld2 again and check things work
--connection server2
--echo # Setup mysqld2 DBUG
--echo # NOTE! since the process will restart there is no need to save value
set global debug='+d,ndb_binlog_fail_setup';
--echo # Write file to make mtr.pl expect mysqld2 shutdown, but don't start
--echo # until it's told to
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.1.expect
wait
EOF
--connection server1
--echo # Create table from mysqld1
create table t1 (a int primary key) engine=ndb;
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
--connection server2
--echo # Wait for mysqld2 diconnect
--source include/wait_until_disconnected.inc
--echo # mysqld2 disconnected
--echo # Write file to make mtr.pl start up mysqld2 again
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.1.expect
restart
EOF
--echo # Wait for mysqld2 to reconnect and insert data to check it's alive
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
--source include/ndb_not_readonly.inc
insert into t1 values (10);
--connection server1
--source include/ndb_not_readonly.inc
insert into t1 values (11);
drop table t1;
#
# Check if binlog prints error message to mysql log
# When it losses connection to NDB during binlog setup
#
set GLOBAL debug="+d,ndb_binlog_fail_setup_util_table";
# Restart cluster nodes
let $out_file = $MYSQLTEST_VARDIR/tmp/mgm_dump.out;
--exec $NDB_MGM -e "all restart" >> $out_file
# Wait for all nodes to enter "started"
--exec $NDB_WAITER >> $out_file
--remove_file $out_file
#
# Wait until the connection to the
# cluster has been restored
#
--source include/ndb_not_readonly.inc
#check if there are any error message in the server log
--let $assert_file=$MYSQLTEST_VARDIR/log/mysqld.1.1.err
--let $assert_text=No error log printed when binlog setup fails
--let $assert_select=Failed to setup binlogging for table
--let $assert_count=0
--source include/assert_grep.inc
set GLOBAL debug="-d,ndb_binlog_fail_setup_util_table";
|