| 1 |
-- source include/have_multi_ndb.inc |
| 2 |
-- source include/have_binlog_format_mixed_or_row.inc |
| 3 |
|
| 4 |
--echo # |
| 5 |
--echo # Tests to test binlogging after mysqld restart |
| 6 |
--echo # This file has tests for the following : |
| 7 |
--echo # 1. WL#12731: Improve database synchronization during mysqld startup |
| 8 |
--echo # 2. Bug#17250994 BAD BINLOG GENERATION AFTER MISMATCH TABLE DISCOVER |
| 9 |
--echo # |
| 10 |
|
| 11 |
--echo # Reset binlogging for test |
| 12 |
-- connection server1 |
| 13 |
reset master; |
| 14 |
-- connection server2 |
| 15 |
reset master; |
| 16 |
|
| 17 |
--echo # Setup |
| 18 |
# Setup for Bug#17250994 |
| 19 |
create table t1 (a int unsigned auto_increment not null primary key) |
| 20 |
engine=ndbcluster; |
| 21 |
|
| 22 |
--echo # Shutdown server 1 |
| 23 |
-- connection server1 |
| 24 |
|
| 25 |
# Ignore the warning generated by ndbcluster's binlog thread |
| 26 |
# when mysqld is restarted |
| 27 |
--disable_query_log ONCE |
| 28 |
call mtr.add_suppression("mysqld startup An incident event has been written"); |
| 29 |
|
| 30 |
# Write file to make mysql-test-run.pl expect the "crash", but don't start |
| 31 |
# it until it's told to. |
| 32 |
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect |
| 33 |
wait |
| 34 |
EOF |
| 35 |
# Send shutdown to the connected server |
| 36 |
--shutdown_server |
| 37 |
# Wait until server is down. |
| 38 |
--source include/wait_until_disconnected.inc |
| 39 |
|
| 40 |
--echo # Run DDLs to be tested on Server1 startup |
| 41 |
-- connection server2 |
| 42 |
|
| 43 |
--echo # Alter table while server 1 is down (To test Bug#17250994) |
| 44 |
alter table t1 algorithm=inplace, add column b varchar(16); |
| 45 |
|
| 46 |
--echo # Create databases when server 1 is down (To test WL#12731) |
| 47 |
create database test_db; |
| 48 |
create table test_db.t1(a int) engine ndb; |
| 49 |
|
| 50 |
--echo # Startup server1 |
| 51 |
-- connection server1 |
| 52 |
# Write file to make mysql-test-run.pl start up the server again. |
| 53 |
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect |
| 54 |
restart |
| 55 |
EOF |
| 56 |
# Turn on reconnect. |
| 57 |
--enable_reconnect |
| 58 |
# Call script that will poll the server waiting for it to be back online again. |
| 59 |
--source include/wait_until_connected_again.inc |
| 60 |
# Turn off reconnect again. |
| 61 |
--disable_reconnect |
| 62 |
|
| 63 |
--echo # Check that the tables are all discovered |
| 64 |
show tables; |
| 65 |
show tables in test_db; |
| 66 |
show create table t1; |
| 67 |
show create table test_db.t1; |
| 68 |
|
| 69 |
--echo # Insert into tables and check binlog |
| 70 |
-- connection server2 |
| 71 |
insert into t1 (b) values('String to find'); |
| 72 |
--echo # Wait for the row to be committed to binlog |
| 73 |
--source include/wait_for_ndb_committed_to_binlog.inc |
| 74 |
|
| 75 |
insert into test_db.t1 values (1); |
| 76 |
--echo # Wait for the row to be committed to binlog |
| 77 |
--source include/wait_for_ndb_committed_to_binlog.inc |
| 78 |
|
| 79 |
--connection server1 |
| 80 |
--echo # check that data went in ok |
| 81 |
select * from t1; |
| 82 |
select * from test_db.t1; |
| 83 |
|
| 84 |
--echo # Verify the row was properly binlogged after alter table |
| 85 |
FLUSH BINARY LOGS; |
| 86 |
let $MYSQLD_DATADIR= `select @@datadir;`; |
| 87 |
--replace_regex /(.*\n)/REMOVE_LINE:\1/ /REMOVE_LINE:(.*@2='String to find'\n)/KEEP_LINE:\1/ /REMOVE_LINE:.*\n// /KEEP_LINE:// |
| 88 |
--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000003 |
| 89 |
|
| 90 |
--echo # View binlog to verify that INSERTS were written properly |
| 91 |
--let $binlog_file=$MYSQLD_DATADIR/binlog.000003 |
| 92 |
--source include/show_binlog_events.inc |
| 93 |
|
| 94 |
--echo # Cleanup |
| 95 |
drop database test_db; |
| 96 |
drop table t1; |