Server IP : 172.67.216.182 / Your IP : 172.69.176.42 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/mysql-test/suite/rpl/t/ |
Upload File : |
# ==== Purpose ==== # # Check that when the exectuion 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 ==== # Create a database `db1` on master and ignore this database on the slave side # using --replicate-ignore-db=db1 --replicate-wild-ignore-table=db1.%. Now # execute a DROP TABLE command with single table in it and the command should # fail because of foreign key constraint. Check in the binlog that query should # not be binlogged. Slave should also be up and running without any errors. # Execute another DROP TABLE command with multiple tables in the drop list and # this also fails because of foreign key constraint, check that query gets # written into the binary log and slave should not fail since query is filtered # on it. # # ==== References ==== # # Bug#21435502: DROP TABLE IF EXISTS MAY BRAKE REPLICATION IF SLAVE HAS # REPLICATION FILTERS. # ################################################################################ --source include/master-slave.inc CREATE DATABASE `db1`; USE `db1`; CREATE TABLE `t1` (`ID` bigint(20) primary key) ENGINE=InnoDB; CREATE TABLE `t2` ( `ID` bigint(20) NOT NULL AUTO_INCREMENT, `DIVISION_ID` bigint(20) DEFAULT NULL, PRIMARY KEY (`ID`), KEY `FK_TABLE1_DIVISION_1` (`DIVISION_ID`), CONSTRAINT `FK_TABLE1_DIVISION_1` FOREIGN KEY (`DIVISION_ID`) REFERENCES `t1` (`ID`) ON DELETE CASCADE ) ENGINE=InnoDB; CREATE TABLE `t3` (`ID` bigint(20) primary key) ENGINE=InnoDB; # Save master position --let $saved_master_pos=query_get_value('SHOW MASTER STATUS', Position, 1) # Test a single table drop failure --error ER_ROW_IS_REFERENCED DROP TABLE IF EXISTS `db1`.`t1`; --let $current_master_pos=query_get_value('SHOW MASTER STATUS', Position, 1) --let $assert_text= Drop with single table should not be written to the binary log if the query execution fails --let $assert_cond= $current_master_pos = $saved_master_pos --source include/assert.inc # Test a multiple table drop failure --error ER_ROW_IS_REFERENCED DROP TABLE `t3`, `t1`, `t2`; --let $binlog_start= $saved_master_pos --source include/show_binlog_events.inc --source include/sync_slave_sql_with_master.inc --echo Cleanup --source include/rpl_connection_master.inc DROP DATABASE `db1`; --source include/rpl_end.inc