mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#19066 (DELETE FROM inconsistency for NDB):
Under row-based replication, DELETE FROM will now always be replicated as individual row deletions, while TRUNCATE TABLE will always be replicated as a statement. mysql-test/extra/rpl_tests/rpl_ddl.test: Using --echo instead of SELECT to print message. mysql-test/r/binlog_row_mix_innodb_myisam.result: Result change. mysql-test/r/federated.result: Result change. mysql-test/r/range.result: Result change. mysql-test/r/rpl_sp_effects.result: Result change. mysql-test/r/show_check.result: Result change. mysql-test/r/sp-error.result: Result change. mysql-test/r/sp.result: Result change. mysql-test/r/timezone2.result: Result change. mysql-test/r/trigger-grant.result: Result change. mysql-test/r/type_datetime.result: Result change. mysql-test/r/type_ranges.result: Result change. mysql-test/r/type_timestamp.result: Result change. mysql-test/r/view.result: Result change. mysql-test/t/archive.test: Test contain statements that only works for statement-based logging. mysql-test/t/disabled.def: Disabling test due to reported bug. mysql-test/t/federated.test: Adding ORDER BY clause to SELECT statements mysql-test/t/range.test: Adding ORDER BY clause to SELECT (sub-)statement mysql-test/t/rpl_sp_effects.test: Adding ORDER BY clause to SELECT statement. mysql-test/t/show_check.test: Replacing DELETE FROM without WHERE with TRUNCATE TABLE. mysql-test/t/sp-error.test: Replacing DELETE FROM without WHERE with TRUNCATE TABLE. mysql-test/t/sp.test: Adding ORDER BY clause to SELECT statement. mysql-test/t/timezone2.test: Replacing DELETE FROM without WHERE with TRUNCATE TABLE. mysql-test/t/trigger-grant.test: Replacing DELETE FROM without WHERE with TRUNCATE TABLE. mysql-test/t/type_datetime.test: Adding ORDER BY clause to SELECT statement. mysql-test/t/type_ranges.test: Replacing DELETE FROM without WHERE with TRUNCATE TABLE. mysql-test/t/type_timestamp.test: Replacing DELETE FROM without WHERE with TRUNCATE TABLE. mysql-test/t/view.test: Adding ORDER BY clause to SELECT statement. sql/sql_class.h: Adding member function to set replication to statement-based. sql/sql_delete.cc: When row-based replication is used, DELETE FROM will always delete the contents of the table row-by-row and not use delete_all_rows(). mysql-test/extra/rpl_tests/rpl_truncate.test: New BitKeeper file ``mysql-test/extra/rpl_tests/rpl_truncate.test'' mysql-test/extra/rpl_tests/rpl_truncate_helper.inc: New BitKeeper file ``mysql-test/extra/rpl_tests/rpl_truncate_helper.inc'' mysql-test/r/rpl_truncate_2myisam.result: New BitKeeper file ``mysql-test/r/rpl_truncate_2myisam.result'' mysql-test/r/rpl_truncate_3innodb.result: New BitKeeper file ``mysql-test/r/rpl_truncate_3innodb.result'' mysql-test/r/rpl_truncate_7ndb.result: New BitKeeper file ``mysql-test/r/rpl_truncate_7ndb.result'' mysql-test/t/rpl_truncate_2myisam.test: New BitKeeper file ``mysql-test/t/rpl_truncate_2myisam.test'' mysql-test/t/rpl_truncate_3innodb.test: New BitKeeper file ``mysql-test/t/rpl_truncate_3innodb.test'' mysql-test/t/rpl_truncate_7ndb.test: New BitKeeper file ``mysql-test/t/rpl_truncate_7ndb.test''
This commit is contained in:
@ -228,15 +228,11 @@ let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SELECT * FROM mysqltest1.t7;
|
||||
connection slave;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave --------' as "";
|
||||
--enable_query_log
|
||||
--echo -------- switch to slave --------
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM mysqltest1.t7;
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to master -------' as "";
|
||||
--enable_query_log
|
||||
|
||||
###############################################################
|
||||
# Cases with LOCK/UNLOCK
|
||||
|
36
mysql-test/extra/rpl_tests/rpl_truncate.test
Normal file
36
mysql-test/extra/rpl_tests/rpl_truncate.test
Normal file
@ -0,0 +1,36 @@
|
||||
#
|
||||
# Copyright 2006 MySQL. All rights reserved.
|
||||
#
|
||||
# Test to check for the different version of truncating a table.
|
||||
# The statements are "TRUNCATE tbl" and "DELETE FROM tbl". We check
|
||||
# the behaviour of each possible value for BINLOG_FORMAT.
|
||||
#
|
||||
# Author(s): Mats Kindahl
|
||||
|
||||
--source include/have_row_based.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
let $format = STATEMENT;
|
||||
let $stmt = TRUNCATE TABLE;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.inc
|
||||
|
||||
let $format = MIXED;
|
||||
let $stmt = TRUNCATE TABLE;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.inc
|
||||
|
||||
let $format = ROW;
|
||||
let $stmt = TRUNCATE TABLE;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.inc
|
||||
|
||||
let $format = STATEMENT;
|
||||
let $stmt = DELETE FROM;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.inc
|
||||
|
||||
let $format = MIXED;
|
||||
let $stmt = DELETE FROM;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.inc
|
||||
|
||||
let $format = ROW;
|
||||
let $stmt = DELETE FROM;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.inc
|
||||
|
40
mysql-test/extra/rpl_tests/rpl_truncate_helper.inc
Normal file
40
mysql-test/extra/rpl_tests/rpl_truncate_helper.inc
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
--disable_query_log
|
||||
--disable_warnings
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET MASTER;
|
||||
connection slave;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
--enable_warnings
|
||||
--enable_query_log
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
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 ****
|
||||
sync_slave_with_master;
|
||||
# Should be empty
|
||||
SELECT * FROM t1;
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||
SHOW BINLOG EVENTS;
|
Reference in New Issue
Block a user