polardbxengine/mysql-test/suite/ndb_rpl/t/ndb_rpl_gap_event.test

84 lines
2.3 KiB
Plaintext

--source include/have_ndb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source suite/ndb_rpl/ndb_master-slave.inc
--connection master
create table t1(pk int not null primary key, i int) engine = ndb;
#
# insert more records into tables
#
let $1=1000;
disable_query_log;
while ($1)
{
eval insert into t1 values($1, $1);
dec $1;
}
enable_query_log;
--sync_slave_with_master
# connect to slave and ensure data is there.
--connection slave
select count(*) from t1;
# Add suppression for the LOST_EVENTS error message
# which will occur on slave when master is restarted while
# slave is running
--disable_query_log
call mtr.add_suppression("Slave.*: The incident LOST_EVENTS occurred on the master");
--enable_query_log
--connection master
--echo Restarting mysqld
# Hack to allow using restart_mysqld.inc from rpl test
let $allow_rpl_inited=1;
# 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");
let $mysqld_name=mysqld.1.1;
--source include/restart_mysqld.inc
# Reconnect all clients configured by rpl_init
--let $rpl_server_number= 1
--source include/rpl_reconnect.inc
# When mysqld starts up again it will:
# - rotate the binary log(thus switching to second log)
# - ndbcluster binlog injector will write the special incident
# event telling that it might not have injected all NDB changes
# i.e LOST_EVENTS, this also causes the binlog to be rotated
# again(thus switching to third log)
#
# Show that the second log contains the LOST_EVENT incident
# and that the binlog has been rotated(ie. flush, rotate and purge).
let $binlog_file=master-bin.000002;
--source include/show_binlog_events.inc
drop table if exists t1;
--echo Get IO thread to reconnect to Master
--connection slave
--disable_result_log
start slave;
--enable_result_log
let $slave_sql_errno= 13119; # ER_SLAVE_INCIDENT
let $show_slave_sql_error=1;
-- source include/wait_for_slave_sql_error.inc
let $status_items= Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_Error;
-- source include/show_slave_status.inc
# Cleanup
drop table if exists t1;
--source include/stop_slave_io.inc
RESET SLAVE;
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc