mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
due to merge.
This commit is contained in:
27
mysql-test/extra/binlog_tests/binlog_truncate.test
Normal file
27
mysql-test/extra/binlog_tests/binlog_truncate.test
Normal file
@ -0,0 +1,27 @@
|
||||
# BUG #36763: TRUNCATE TABLE fails to replicate when stmt-based
|
||||
# binlogging is not supported.
|
||||
|
||||
# This should always be logged as a statement, even when executed as a
|
||||
# row-by-row deletion.
|
||||
|
||||
# $before_truncate A statement to execute (just) before issuing the
|
||||
# TRUNCATE TABLE
|
||||
|
||||
|
||||
eval CREATE TABLE t1 (a INT) ENGINE=$engine;
|
||||
eval CREATE TABLE t2 (a INT) ENGINE=$engine;
|
||||
INSERT INTO t2 VALUES (1),(2),(3);
|
||||
let $binlog_start = query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
if (`select length('$before_truncate') > 0`) {
|
||||
eval $before_truncate;
|
||||
}
|
||||
--echo **** Truncate of empty table shall be logged
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
if (`select length('$before_truncate') > 0`) {
|
||||
eval $before_truncate;
|
||||
}
|
||||
TRUNCATE TABLE t2;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
DROP TABLE t1,t2;
|
@ -9,27 +9,8 @@
|
||||
|
||||
--source include/master-slave.inc
|
||||
|
||||
let $format = STATEMENT;
|
||||
let $stmt = TRUNCATE TABLE;
|
||||
let $trunc_stmt = TRUNCATE TABLE;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.test
|
||||
|
||||
let $format = MIXED;
|
||||
let $stmt = TRUNCATE TABLE;
|
||||
let $trunc_stmt = DELETE FROM;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.test
|
||||
|
||||
let $format = ROW;
|
||||
let $stmt = TRUNCATE TABLE;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.test
|
||||
|
||||
let $format = STATEMENT;
|
||||
let $stmt = DELETE FROM;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.test
|
||||
|
||||
let $format = MIXED;
|
||||
let $stmt = DELETE FROM;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.test
|
||||
|
||||
let $format = ROW;
|
||||
let $stmt = DELETE FROM;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.test
|
||||
|
||||
|
@ -1,47 +1,35 @@
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
connection slave;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
source include/reset_master_and_slave.inc;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
|
||||
eval SET SESSION BINLOG_FORMAT=$format;
|
||||
eval SET GLOBAL BINLOG_FORMAT=$format;
|
||||
|
||||
eval CREATE TABLE t1 (a INT, b LONG) ENGINE=$engine;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
eval $stmt t1;
|
||||
SELECT * FROM t1;
|
||||
--echo **** On Slave ****
|
||||
eval $trunc_stmt t1;
|
||||
sync_slave_with_master;
|
||||
# Should be empty
|
||||
SELECT * FROM t1;
|
||||
|
||||
let $diff_table_1=master:test.t1;
|
||||
let $diff_table_2=slave:test.t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo ==== Test using a table with delete triggers ====
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
let $SERVER_VERSION=`select version()`;
|
||||
source include/show_binlog_events.inc;
|
||||
SET @count := 1;
|
||||
eval CREATE TABLE t2 (a INT, b LONG) ENGINE=$engine;
|
||||
CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1;
|
||||
sync_slave_with_master;
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
eval $trunc_stmt t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_table_1=master:test.t2;
|
||||
let $diff_table_2=slave:test.t2;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
DROP TABLE t1,t2;
|
||||
sync_slave_with_master;
|
||||
|
@ -77,14 +77,29 @@ static void message(const char* fmt, ...)
|
||||
|
||||
static void die(const char* fmt, ...)
|
||||
{
|
||||
DWORD last_err= GetLastError();
|
||||
va_list args;
|
||||
fprintf(stderr, "%s: FATAL ERROR, ", safe_process_name);
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
fprintf(stderr, "\n");
|
||||
va_end(args);
|
||||
if (int last_err= GetLastError())
|
||||
fprintf(stderr, "error: %d, %s\n", last_err, strerror(last_err));
|
||||
if (last_err)
|
||||
{
|
||||
char *message_text;
|
||||
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER
|
||||
|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, last_err , 0, (LPSTR)&message_text,
|
||||
0, NULL))
|
||||
{
|
||||
fprintf(stderr,"error: %d, %s\n",last_err, message_text);
|
||||
LocalFree(message_text);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FormatMessage failed, print error code only */
|
||||
fprintf(stderr,"error:%d\n", last_err);
|
||||
}
|
||||
}
|
||||
fflush(stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ BEGIN {
|
||||
print "=======================================================\n";
|
||||
print " WARNING: Using mysql-test-run.pl version 1! \n";
|
||||
print "=======================================================\n";
|
||||
require "lib/v1/mysql-test-run.pl";
|
||||
exit(1);
|
||||
# Should use exec() here on *nix but this appears not to work on Windows
|
||||
exit(system($^X, "lib/v1/mysql-test-run.pl", @ARGV) >> 8);
|
||||
}
|
||||
elsif ( $version == 2 )
|
||||
{
|
||||
|
@ -687,8 +687,8 @@ SUCCESS
|
||||
|
||||
truncate table t2;
|
||||
call p_verify_status_increment(4, 0, 4, 0);
|
||||
SUCCESS
|
||||
|
||||
ERROR
|
||||
Expected commit increment: 4 actual: 2
|
||||
commit;
|
||||
# There is nothing left to commit
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
@ -854,8 +854,8 @@ SUCCESS
|
||||
|
||||
truncate table t3;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
SUCCESS
|
||||
|
||||
ERROR
|
||||
Expected commit increment: 4 actual: 2
|
||||
create view v1 as select * from t2;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
@ -215,7 +215,7 @@ COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
@ -223,22 +223,6 @@ SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
@ -347,17 +331,9 @@ COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t2
|
||||
@ -473,17 +449,9 @@ ROLLBACK
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t2
|
||||
|
@ -379,9 +379,7 @@ master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
@ -401,9 +399,7 @@ master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; ROLLBACK
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
|
@ -346,9 +346,7 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (3,3)
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4,4)
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5,5)
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t2
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (6,6)
|
||||
@ -356,9 +354,7 @@ master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE t2 (a int, b in
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (7,7)
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (8,8)
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (9,9)
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (10,10)
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (100,100)
|
||||
|
63
mysql-test/suite/binlog/r/binlog_truncate_innodb.result
Normal file
63
mysql-test/suite/binlog/r/binlog_truncate_innodb.result
Normal file
@ -0,0 +1,63 @@
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1),(2),(3);
|
||||
**** Truncate of empty table shall be logged
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1),(2),(3);
|
||||
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
**** Truncate of empty table shall be logged
|
||||
TRUNCATE TABLE t1;
|
||||
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
TRUNCATE TABLE t2;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1),(2),(3);
|
||||
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
**** Truncate of empty table shall be logged
|
||||
TRUNCATE TABLE t1;
|
||||
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
TRUNCATE TABLE t2;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1),(2),(3);
|
||||
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
**** Truncate of empty table shall be logged
|
||||
TRUNCATE TABLE t1;
|
||||
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
TRUNCATE TABLE t2;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1),(2),(3);
|
||||
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
**** Truncate of empty table shall be logged
|
||||
TRUNCATE TABLE t1;
|
||||
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
TRUNCATE TABLE t2;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
|
||||
DROP TABLE t1,t2;
|
12
mysql-test/suite/binlog/r/binlog_truncate_myisam.result
Normal file
12
mysql-test/suite/binlog/r/binlog_truncate_myisam.result
Normal file
@ -0,0 +1,12 @@
|
||||
RESET MASTER;
|
||||
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (a INT) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (1),(2),(3);
|
||||
**** Truncate of empty table shall be logged
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
|
||||
DROP TABLE t1,t2;
|
@ -220,3 +220,10 @@ Warning 1592 Statement is not safe to log in statement format.
|
||||
Warning 1592 Statement is not safe to log in statement format.
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100));
|
||||
INSERT INTO t1 VALUES ('a','b');
|
||||
UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
|
||||
Warnings:
|
||||
Warning 1592 Statement is not safe to log in statement format.
|
||||
DROP TABLE t1;
|
||||
|
@ -0,0 +1 @@
|
||||
--loose-innodb
|
29
mysql-test/suite/binlog/t/binlog_truncate_innodb.test
Normal file
29
mysql-test/suite/binlog/t/binlog_truncate_innodb.test
Normal file
@ -0,0 +1,29 @@
|
||||
source include/have_log_bin.inc;
|
||||
source include/have_innodb.inc;
|
||||
|
||||
# It is necessary to reset the master since otherwise the binlog test
|
||||
# might show the wrong binary log. The default for SHOW BINLOG EVENTS
|
||||
# is to show the first binary log, not the current one (which is
|
||||
# actually a better idea).
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
let $engine = InnoDB;
|
||||
source extra/binlog_tests/binlog_truncate.test;
|
||||
|
||||
# Under transaction isolation level READ UNCOMMITTED and READ
|
||||
# COMMITTED, InnoDB does not permit statement-based replication of
|
||||
# row-deleting statement. In these cases, TRUNCATE TABLE should still
|
||||
# be replicated as a statement.
|
||||
|
||||
let $before_truncate = SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
source extra/binlog_tests/binlog_truncate.test;
|
||||
|
||||
let $before_truncate = SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
source extra/binlog_tests/binlog_truncate.test;
|
||||
|
||||
let $before_truncate = SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
source extra/binlog_tests/binlog_truncate.test;
|
||||
|
||||
let $before_truncate = SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
source extra/binlog_tests/binlog_truncate.test;
|
11
mysql-test/suite/binlog/t/binlog_truncate_myisam.test
Normal file
11
mysql-test/suite/binlog/t/binlog_truncate_myisam.test
Normal file
@ -0,0 +1,11 @@
|
||||
source include/have_log_bin.inc;
|
||||
|
||||
# It is necessary to reset the master since otherwise the binlog test
|
||||
# might show the wrong binary log. The default for SHOW BINLOG EVENTS
|
||||
# is to show the first binary log, not the current one (which is
|
||||
# actually a better idea).
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
let $engine = MyISAM;
|
||||
source extra/binlog_tests/binlog_truncate.test;
|
@ -257,3 +257,17 @@ delimiter ;|
|
||||
CALL p1();
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#42634: % character in query can cause mysqld signal 11 segfault
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100));
|
||||
INSERT INTO t1 VALUES ('a','b');
|
||||
UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -9,3 +9,5 @@
|
||||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
binlog_truncate_innodb : BUG#42643 2009-02-06 mats Changes to InnoDB requires to complete fix for BUG#36763
|
||||
|
||||
|
97
mysql-test/suite/rpl/r/rpl_drop_if_exists.result
Normal file
97
mysql-test/suite/rpl/r/rpl_drop_if_exists.result
Normal file
@ -0,0 +1,97 @@
|
||||
DROP PROCEDURE IF EXISTS db_bug_13684.p;
|
||||
DROP FUNCTION IF EXISTS db_bug_13684.f;
|
||||
DROP TRIGGER IF EXISTS db_bug_13684.tr;
|
||||
DROP VIEW IF EXISTS db_bug_13684.v;
|
||||
DROP EVENT IF EXISTS db_bug_13684.e;
|
||||
DROP TABLE IF EXISTS db_bug_13684.t;
|
||||
DROP DATABASE IF EXISTS db_bug_13684;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p
|
||||
master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f
|
||||
master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
|
||||
master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
|
||||
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
|
||||
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
|
||||
CREATE DATABASE db_bug_13684;
|
||||
CREATE TABLE db_bug_13684.t (a int);
|
||||
CREATE EVENT db_bug_13684.e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO
|
||||
UPDATE db_bug_13684.t SET a = a + 1;
|
||||
CREATE VIEW db_bug_13684.v
|
||||
AS SELECT * FROM db_bug_13684.t;
|
||||
CREATE TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t
|
||||
FOR EACH ROW BEGIN
|
||||
END;
|
||||
CREATE PROCEDURE db_bug_13684.p (OUT p1 INT)
|
||||
BEGIN
|
||||
END;
|
||||
CREATE FUNCTION db_bug_13684.f (s CHAR(20))
|
||||
RETURNS CHAR(50) DETERMINISTIC
|
||||
RETURN s;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p
|
||||
master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f
|
||||
master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
|
||||
master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
|
||||
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
|
||||
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
|
||||
master-bin.000001 # Query # # CREATE DATABASE db_bug_13684
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int)
|
||||
master-bin.000001 # Query # # use `test`; CREATE EVENT db_bug_13684.e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO
|
||||
UPDATE db_bug_13684.t SET a = a + 1
|
||||
master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db_bug_13684`.`v` AS SELECT * FROM db_bug_13684.t
|
||||
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t
|
||||
FOR EACH ROW BEGIN
|
||||
END
|
||||
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `db_bug_13684`.`p`(OUT p1 INT)
|
||||
BEGIN
|
||||
END
|
||||
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db_bug_13684`.`f`(s CHAR(20)) RETURNS char(50) CHARSET latin1
|
||||
DETERMINISTIC
|
||||
RETURN s
|
||||
DROP PROCEDURE IF EXISTS db_bug_13684.p;
|
||||
DROP FUNCTION IF EXISTS db_bug_13684.f;
|
||||
DROP TRIGGER IF EXISTS db_bug_13684.tr;
|
||||
DROP VIEW IF EXISTS db_bug_13684.v;
|
||||
DROP EVENT IF EXISTS db_bug_13684.e;
|
||||
DROP TABLE IF EXISTS db_bug_13684.t;
|
||||
DROP DATABASE IF EXISTS db_bug_13684;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p
|
||||
master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f
|
||||
master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
|
||||
master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
|
||||
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
|
||||
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
|
||||
master-bin.000001 # Query # # CREATE DATABASE db_bug_13684
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int)
|
||||
master-bin.000001 # Query # # use `test`; CREATE EVENT db_bug_13684.e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO
|
||||
UPDATE db_bug_13684.t SET a = a + 1
|
||||
master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db_bug_13684`.`v` AS SELECT * FROM db_bug_13684.t
|
||||
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t
|
||||
FOR EACH ROW BEGIN
|
||||
END
|
||||
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `db_bug_13684`.`p`(OUT p1 INT)
|
||||
BEGIN
|
||||
END
|
||||
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db_bug_13684`.`f`(s CHAR(20)) RETURNS char(50) CHARSET latin1
|
||||
DETERMINISTIC
|
||||
RETURN s
|
||||
master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p
|
||||
master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f
|
||||
master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
|
||||
master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
|
||||
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
|
||||
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
|
@ -963,9 +963,7 @@ master-bin.000001 # Xid 1 # #
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; BEGIN
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
|
||||
master-bin.000001 # Xid 1 # #
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; BEGIN
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; TRUNCATE t1
|
||||
master-bin.000001 # Xid 1 # #
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; BEGIN
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
|
||||
master-bin.000001 # Xid 1 # #
|
||||
|
@ -511,6 +511,7 @@ master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
|
||||
master-bin.000001 # Query 1 # drop database mysqltest1
|
||||
master-bin.000001 # Query 1 # drop user "zedjzlcsjhd"@127.0.0.1
|
||||
master-bin.000001 # Query 1 # use `test`; drop function if exists f1
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
|
||||
READS SQL DATA
|
||||
begin
|
||||
@ -526,12 +527,15 @@ master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query 1 # use `test`; insert into t1 (a) values (f1())
|
||||
master-bin.000001 # Query 1 # use `test`; drop view v1
|
||||
master-bin.000001 # Query 1 # use `test`; drop function f1
|
||||
master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE IF EXISTS p1
|
||||
master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(col VARCHAR(10))
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
|
||||
INSERT INTO t1 VALUES(arg)
|
||||
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
|
||||
master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1
|
||||
master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE IF EXISTS p1
|
||||
master-bin.000001 # Query 1 # use `test`; DROP FUNCTION IF EXISTS f1
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
SET @a = 1
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
|
||||
@ -842,6 +846,9 @@ drop user "zedjzlcsjhd"@127.0.0.1
|
||||
/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=t/*!*/;
|
||||
drop function if exists f1
|
||||
/*!*/;
|
||||
SET TIMESTAMP=t/*!*/;
|
||||
CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
|
||||
READS SQL DATA
|
||||
begin
|
||||
@ -869,6 +876,9 @@ SET TIMESTAMP=t/*!*/;
|
||||
drop function f1
|
||||
/*!*/;
|
||||
SET TIMESTAMP=t/*!*/;
|
||||
DROP PROCEDURE IF EXISTS p1
|
||||
/*!*/;
|
||||
SET TIMESTAMP=t/*!*/;
|
||||
DROP TABLE IF EXISTS t1
|
||||
/*!*/;
|
||||
SET TIMESTAMP=t/*!*/;
|
||||
@ -885,6 +895,12 @@ SET TIMESTAMP=t/*!*/;
|
||||
DROP PROCEDURE p1
|
||||
/*!*/;
|
||||
SET TIMESTAMP=t/*!*/;
|
||||
DROP PROCEDURE IF EXISTS p1
|
||||
/*!*/;
|
||||
SET TIMESTAMP=t/*!*/;
|
||||
DROP FUNCTION IF EXISTS f1
|
||||
/*!*/;
|
||||
SET TIMESTAMP=t/*!*/;
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
SET @a = 1
|
||||
/*!*/;
|
||||
|
@ -4,265 +4,43 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
**** Resetting master and slave ****
|
||||
include/stop_slave.inc
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
RESET MASTER;
|
||||
include/start_slave.inc
|
||||
**** On Master ****
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
SET SESSION BINLOG_FORMAT=STATEMENT;
|
||||
SET GLOBAL BINLOG_FORMAT=STATEMENT;
|
||||
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
**** On Master ****
|
||||
TRUNCATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
==== Test using a table with delete triggers ====
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
**** On Master ****
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
SET SESSION BINLOG_FORMAT=MIXED;
|
||||
SET GLOBAL BINLOG_FORMAT=MIXED;
|
||||
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
SET @count := 1;
|
||||
CREATE TABLE t2 (a INT, b LONG) ENGINE=MyISAM;
|
||||
CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1;
|
||||
**** On Master ****
|
||||
TRUNCATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
Comparing tables master:test.t2 and slave:test.t2
|
||||
DROP TABLE t1,t2;
|
||||
**** Resetting master and slave ****
|
||||
include/stop_slave.inc
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
RESET MASTER;
|
||||
include/start_slave.inc
|
||||
**** On Master ****
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
SET SESSION BINLOG_FORMAT=ROW;
|
||||
SET GLOBAL BINLOG_FORMAT=ROW;
|
||||
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
**** On Master ****
|
||||
TRUNCATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
**** On Master ****
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
SET SESSION BINLOG_FORMAT=STATEMENT;
|
||||
SET GLOBAL BINLOG_FORMAT=STATEMENT;
|
||||
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
**** On Master ****
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
==== Test using a table with delete triggers ====
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
|
||||
master-bin.000001 # Query # # use `test`; DELETE FROM t1
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
**** On Master ****
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
SET SESSION BINLOG_FORMAT=MIXED;
|
||||
SET GLOBAL BINLOG_FORMAT=MIXED;
|
||||
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
SET @count := 1;
|
||||
CREATE TABLE t2 (a INT, b LONG) ENGINE=MyISAM;
|
||||
CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1;
|
||||
**** On Master ****
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
|
||||
master-bin.000001 # Query # # use `test`; DELETE FROM t1
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
**** On Master ****
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
SET SESSION BINLOG_FORMAT=ROW;
|
||||
SET GLOBAL BINLOG_FORMAT=ROW;
|
||||
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
**** On Master ****
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
3 3
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
Comparing tables master:test.t2 and slave:test.t2
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -4,283 +4,43 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
**** Resetting master and slave ****
|
||||
include/stop_slave.inc
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
RESET MASTER;
|
||||
include/start_slave.inc
|
||||
**** On Master ****
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
SET SESSION BINLOG_FORMAT=STATEMENT;
|
||||
SET GLOBAL BINLOG_FORMAT=STATEMENT;
|
||||
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
**** On Master ****
|
||||
TRUNCATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
==== Test using a table with delete triggers ====
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
**** On Master ****
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
SET SESSION BINLOG_FORMAT=MIXED;
|
||||
SET GLOBAL BINLOG_FORMAT=MIXED;
|
||||
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
SET @count := 1;
|
||||
CREATE TABLE t2 (a INT, b LONG) ENGINE=InnoDB;
|
||||
CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1;
|
||||
**** On Master ****
|
||||
TRUNCATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
Comparing tables master:test.t2 and slave:test.t2
|
||||
DROP TABLE t1,t2;
|
||||
**** Resetting master and slave ****
|
||||
include/stop_slave.inc
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
RESET MASTER;
|
||||
include/start_slave.inc
|
||||
**** On Master ****
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
SET SESSION BINLOG_FORMAT=ROW;
|
||||
SET GLOBAL BINLOG_FORMAT=ROW;
|
||||
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
**** On Master ****
|
||||
TRUNCATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
**** On Master ****
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
SET SESSION BINLOG_FORMAT=STATEMENT;
|
||||
SET GLOBAL BINLOG_FORMAT=STATEMENT;
|
||||
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
**** On Master ****
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
==== Test using a table with delete triggers ====
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; DELETE FROM t1
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
**** On Master ****
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
SET SESSION BINLOG_FORMAT=MIXED;
|
||||
SET GLOBAL BINLOG_FORMAT=MIXED;
|
||||
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
SET @count := 1;
|
||||
CREATE TABLE t2 (a INT, b LONG) ENGINE=InnoDB;
|
||||
CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1;
|
||||
**** On Master ****
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; DELETE FROM t1
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
**** On Master ****
|
||||
SET @old_session_binlog_format= @@session.binlog_format;
|
||||
SET @old_global_binlog_format= @@global.binlog_format;
|
||||
SET SESSION BINLOG_FORMAT=ROW;
|
||||
SET GLOBAL BINLOG_FORMAT=ROW;
|
||||
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
**** On Slave ****
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
**** On Master ****
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
**** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
3 3
|
||||
**** On Master ****
|
||||
DROP TABLE t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
RESET MASTER;
|
||||
SET @@session.binlog_format= @old_session_binlog_format;
|
||||
SET @@global.binlog_format= @old_global_binlog_format;
|
||||
Comparing tables master:test.t2 and slave:test.t2
|
||||
DROP TABLE t1,t2;
|
||||
|
114
mysql-test/suite/rpl/t/rpl_drop_if_exists.test
Normal file
114
mysql-test/suite/rpl/t/rpl_drop_if_exists.test
Normal file
@ -0,0 +1,114 @@
|
||||
# BUG#13684:
|
||||
# SP: DROP PROCEDURE|FUNCTION IF EXISTS not binlogged if routine
|
||||
# does not exist
|
||||
#
|
||||
# There is an inconsistency with DROP DATABASE IF EXISTS, DROP
|
||||
# TABLE IF EXISTS and DROP VIEW IF EXISTS: those are binlogged even
|
||||
# if the DB or TABLE does not exist, whereas DROP PROCEDURE IF
|
||||
# EXISTS does not. It would be nice or at least consistent if DROP
|
||||
# PROCEDURE/STATEMENT worked the same too.
|
||||
#
|
||||
# Description:
|
||||
# DROP PROCEDURE|FUNCTION IF EXISTS does not get binlogged whereas DROP
|
||||
# DATABASE|TABLE|TRIGGER|... IF EXISTS do.
|
||||
#
|
||||
# Fixed DROP PROCEDURE|FUNCTION IF EXISTS by adding a call to
|
||||
# write_bin_log in mysql_execute_command. Checked also if all
|
||||
# documented "DROP (...) IF EXISTS" get binlogged. Left out DROP
|
||||
# SERVER IF EXISTS because it seems that it only gets binlogged when
|
||||
# using row event (see BUG#25705).
|
||||
#
|
||||
# TODO: add DROP SERVER IF EXISTS to the test case when its
|
||||
# binlogging procedure gets fixed (BUG#25705). Furthermore, when
|
||||
# logging in RBR format the events that get logged are effectively in
|
||||
# RBR format and not in STATEMENT format meaning that one must needs
|
||||
# to be extra careful when writing a test for it, or change the CREATE
|
||||
# SERVER logging to always log as STATEMENT. You can quickly check this
|
||||
# by enabling the flag below $fixed_bug_25705=1 and watch the diff on
|
||||
# the STDOUT. More detail may be found on the generated reject file.
|
||||
#
|
||||
# Test is implemented as follows:
|
||||
#
|
||||
# i) test each "drop if exists" (DDL), found in MySQL 5.1 manual,
|
||||
# on inexistent objects (except for DROP SERVER);
|
||||
# ii) show binlog events;
|
||||
# iii) create an object for each drop if exists statement;
|
||||
# iv) issue "drop if exists" in existent objects.
|
||||
# v) show binlog events;
|
||||
#
|
||||
# References:
|
||||
# http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html
|
||||
#
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
disable_warnings;
|
||||
|
||||
# test all "drop if exists" in manual with inexistent objects
|
||||
DROP PROCEDURE IF EXISTS db_bug_13684.p;
|
||||
DROP FUNCTION IF EXISTS db_bug_13684.f;
|
||||
DROP TRIGGER IF EXISTS db_bug_13684.tr;
|
||||
DROP VIEW IF EXISTS db_bug_13684.v;
|
||||
DROP EVENT IF EXISTS db_bug_13684.e;
|
||||
DROP TABLE IF EXISTS db_bug_13684.t;
|
||||
DROP DATABASE IF EXISTS db_bug_13684;
|
||||
|
||||
let $fixed_bug_25705 = 0;
|
||||
|
||||
if($fixed_bug_25705)
|
||||
{
|
||||
DROP SERVER IF EXISTS s_bug_13684;
|
||||
}
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
# test drop with existing values
|
||||
|
||||
# create
|
||||
CREATE DATABASE db_bug_13684;
|
||||
|
||||
CREATE TABLE db_bug_13684.t (a int);
|
||||
|
||||
CREATE EVENT db_bug_13684.e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO
|
||||
UPDATE db_bug_13684.t SET a = a + 1;
|
||||
|
||||
CREATE VIEW db_bug_13684.v
|
||||
AS SELECT * FROM db_bug_13684.t;
|
||||
|
||||
CREATE TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t
|
||||
FOR EACH ROW BEGIN
|
||||
END;
|
||||
|
||||
CREATE PROCEDURE db_bug_13684.p (OUT p1 INT)
|
||||
BEGIN
|
||||
END;
|
||||
|
||||
CREATE FUNCTION db_bug_13684.f (s CHAR(20))
|
||||
RETURNS CHAR(50) DETERMINISTIC
|
||||
RETURN s;
|
||||
|
||||
if($fixed_bug_25705)
|
||||
{
|
||||
CREATE SERVER s_bug_13684
|
||||
FOREIGN DATA WRAPPER mysql
|
||||
OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test');
|
||||
}
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
# drop existing
|
||||
DROP PROCEDURE IF EXISTS db_bug_13684.p;
|
||||
DROP FUNCTION IF EXISTS db_bug_13684.f;
|
||||
DROP TRIGGER IF EXISTS db_bug_13684.tr;
|
||||
DROP VIEW IF EXISTS db_bug_13684.v;
|
||||
DROP EVENT IF EXISTS db_bug_13684.e;
|
||||
DROP TABLE IF EXISTS db_bug_13684.t;
|
||||
DROP DATABASE IF EXISTS db_bug_13684;
|
||||
if($fixed_bug_25705)
|
||||
{
|
||||
DROP SERVER IF EXISTS s_bug_13684;
|
||||
}
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
enable_warnings;
|
Reference in New Issue
Block a user