polardbxengine/mysql-test/suite/ndb_binlog/t/ndb_binlog_discover_multi.test

98 lines
3.0 KiB
Plaintext

-- source include/have_multi_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc
--echo #
--echo # Tests to test binlogging after mysqld restart
--echo # This file has tests for the following :
--echo # 1. WL#12731: Improve database synchronization during mysqld startup
--echo # 2. Bug#17250994 BAD BINLOG GENERATION AFTER MISMATCH TABLE DISCOVER
--echo #
--echo # Reset binlogging for test
-- connection server1
reset master;
-- connection server2
reset master;
--echo # Setup
# Setup for Bug#17250994
create table t1 (a int unsigned auto_increment not null primary key)
engine=ndbcluster;
--echo # Shutdown server 1
-- connection server1
# Ignore the warning generated by ndbcluster's binlog thread
# when mysqld is restarted
--disable_query_log ONCE
call mtr.add_suppression("mysqld startup An incident event has been written");
# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to.
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect
wait
EOF
# Send shutdown to the connected server and give
# it 30 seconds to die before zapping it.
shutdown_server 30;
# Wait until server is down.
--source include/wait_until_disconnected.inc
--echo # Run DDLs to be tested on Server1 startup
-- connection server2
--echo # Alter table while server 1 is down (To test Bug#17250994)
alter table t1 algorithm=inplace, add column b varchar(16);
--echo # Create databases when server 1 is down (To test WL#12731)
create database test_db;
create table test_db.t1(a int) engine ndb;
--echo # Startup server1
-- connection server1
# Write file to make mysql-test-run.pl start up the server again.
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect
restart
EOF
# Turn on reconnect.
--enable_reconnect
# Call script that will poll the server waiting for it to be back online again.
--source include/wait_until_connected_again.inc
# Turn off reconnect again.
--disable_reconnect
--echo # Check that the tables are all discovered
show tables;
show tables in test_db;
show create table t1;
show create table test_db.t1;
--echo # Insert into tables and check binlog
-- connection server2
insert into t1 (b) values('String to find');
--echo # Wait for the row to be committed to binlog
--source include/wait_for_ndb_committed_to_binlog.inc
insert into test_db.t1 values (1);
--echo # Wait for the row to be committed to binlog
--source include/wait_for_ndb_committed_to_binlog.inc
--connection server1
--echo # check that data went in ok
select * from t1;
select * from test_db.t1;
--echo # Verify the row was properly binlogged after alter table
FLUSH BINARY LOGS;
let $MYSQLD_DATADIR= `select @@datadir;`;
--replace_regex /(.*\n)/REMOVE_LINE:\1/ /REMOVE_LINE:(.*@2='String to find'\n)/KEEP_LINE:\1/ /REMOVE_LINE:.*\n// /KEEP_LINE://
--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000003
--echo # View binlog to verify that INSERTS were written properly
--let $binlog_file=$MYSQLD_DATADIR/binlog.000003
--source include/show_binlog_events.inc
--echo # Cleanup
drop database test_db;
drop table t1;