mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 22:12:30 +01:00
e3708c231e
TRUNCATE TABLE fails to replicate when stmt-based binlogging is not supported. There were two separate problems with the code, both of which are fixed with this patch: 1. An error was printed by InnoDB for TRUNCATE TABLE in statement mode when the in isolation levels READ COMMITTED and READ UNCOMMITTED since InnoDB does permit statement-based replication for DML statements. However, the TRUNCATE TABLE is not transactional, but is a DDL, and should therefore be allowed to be replicated as a statement. 2. The statement was not logged in mixed mode because of the error above, but the error was not reported to the client. This patch fixes the problem by treating TRUNCATE TABLE a DDL, that is, it is always logged as a statement and not reporting an error from InnoDB for TRUNCATE TABLE.
35 lines
924 B
Text
35 lines
924 B
Text
source include/reset_master_and_slave.inc;
|
|
|
|
--echo **** On Master ****
|
|
connection master;
|
|
eval CREATE TABLE t1 (a INT, b LONG) ENGINE=$engine;
|
|
INSERT INTO t1 VALUES (1,1), (2,2);
|
|
sync_slave_with_master;
|
|
--echo **** On Master ****
|
|
connection master;
|
|
eval $trunc_stmt t1;
|
|
sync_slave_with_master;
|
|
|
|
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;
|
|
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;
|
|
DROP TABLE t1,t2;
|
|
sync_slave_with_master;
|