mirror of
https://github.com/MariaDB/server.git
synced 2025-12-01 17:39:21 +03:00
Problem: ======= DROP TABLE IF EXISTS was killed. The table still exists on the master but the DDL was still logged. Analysis: ========= During the execution of DROP TABLE command "ha_delete_table" call is invoked to delete the table. If the query is killed at this point, the kill command is not handled within the code. This results in two issues. 1) The table which is not dropped also gets written into the binary log. 2) The code continues further upon receiving 'KILL QUERY'. Fix: === Upon receiving the KILL command the query should stop its current execution. Tables which were successfully dropped prior to KILL command should be included in the binary log.
65 lines
2.0 KiB
Plaintext
65 lines
2.0 KiB
Plaintext
# ==== Purpose ====
|
|
#
|
|
# Check that when the execution of a DROP TABLE command with single table
|
|
# fails it should not be written to the binary log. Also test that when the
|
|
# execution of DROP TABLE command with multiple tables fails the command
|
|
# should be written into the binary log.
|
|
#
|
|
# ==== Implementation ====
|
|
#
|
|
# Steps:
|
|
# 0 - Create tables named t1, t2, t3
|
|
# 1 - Execute DROP TABLE t1,t2,t3 command.
|
|
# 2 - Kill the DROP TABLE command while it is trying to drop table 't2'.
|
|
# 3 - Verify that tables t2,t3 are present after the DROP command execution
|
|
# was interrupted.
|
|
# 4 - Check that table 't1' is present in binary log as part of DROP
|
|
# command.
|
|
#
|
|
# ==== References ====
|
|
#
|
|
# MDEV-20348: DROP TABLE IF EXISTS killed on master but was replicated.
|
|
#
|
|
|
|
--source include/have_innodb.inc
|
|
--source include/have_debug_sync.inc
|
|
--source include/have_binlog_format_statement.inc
|
|
--source include/master-slave.inc
|
|
|
|
create table t1 (a int) engine=innodb;
|
|
create table t2 (b longblob) engine=innodb;
|
|
create table t3 (c int) engine=innodb;
|
|
insert into t2 values (repeat('b',1024*1024));
|
|
insert into t2 select * from t2;
|
|
insert into t2 select * from t2;
|
|
insert into t2 select * from t2;
|
|
insert into t2 select * from t2;
|
|
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
|
|
|
let $id=`select connection_id()`;
|
|
set debug_sync='rm_table_no_locks_before_delete_table SIGNAL nogo WAIT_FOR go EXECUTE 2';
|
|
send drop table t1, t2, t3;
|
|
|
|
connect foo,localhost,root;
|
|
set debug_sync='now SIGNAL go';
|
|
let $wait_condition=select 1 from information_schema.processlist where state like 'debug sync point:%';
|
|
source include/wait_condition.inc;
|
|
--replace_result $id CONNECTION_ID
|
|
eval kill query $id;
|
|
|
|
connection master;
|
|
error ER_QUERY_INTERRUPTED;
|
|
reap;
|
|
|
|
--echo "Tables t2 and t3 should be listed"
|
|
SHOW TABLES;
|
|
--source include/show_binlog_events.inc
|
|
--sync_slave_with_master
|
|
drop table t2, t3;
|
|
|
|
connection master;
|
|
set debug_sync='RESET';
|
|
drop table t2, t3;
|
|
|
|
source include/rpl_end.inc;
|