mariadb/mysql-test/suite/rpl/t/rpl_multi_delete_join.test
Dave Gosselin eea493463b MDEV-38003: Intermittent Replication Failure on a multi-table DELETE
When deleting from multiple tables, the DELETE operator uses a temporary table
to collect the row IDs of rows that will be deleted. If this table grows too
large, then we convert it from a heap temporary table to a persistent (on-disk)
temporary table to avoid unbounded memory usage. There are several error codes
that gate creating this persistent temporary table but themselves don't
indicate a problem with the DELETE operation. However, regardless of this error
code value, we need to clear it after deciding whether or not to create the
persistent temporary table. If we don't clear this value, then the error
code's stale state prevents binlog replication when its value is muxed with
local_error during multi_delete::send_eof.
2025-12-17 22:13:49 +01:00

46 lines
1.6 KiB
Text

source include/master-slave.inc;
--echo #
--echo # MDEV-38003 Intermittent Replication Failure on a multi-table DELETE
--echo #
connection master;
set sql_log_bin=1;
sync_slave_with_master;
set sql_log_bin=1;
reset master;
connection master;
create database mdev38003;
use mdev38003;
create table t1 (pk int, num int);
create table t2 (pk int, num int);
create table t3 (pk int, num int);
insert into t1 (pk, num) values (1,1900),(2,1901);
insert into t2 (pk, num) values (2,2001),(2,2002);
insert into t3 (pk, num) values (1,40),(2,42);
select * from t1 left join t2 on t1.pk = t2.pk left join t3 on t2.pk = t3.pk;
select * from t1 left join t2 on t1.pk = t2.pk left join t3 on t2.pk = t3.pk where t2.num <= 2002;
sync_slave_with_master;
use mdev38003;
select * from t1 left join t2 on t1.pk = t2.pk left join t3 on t2.pk = t3.pk;
select * from t1 left join t2 on t1.pk = t2.pk left join t3 on t2.pk = t3.pk where t2.num <= 2002;
connection master;
use mdev38003;
delete t1, t2, t3 from t1 left join t2 on t1.pk = t2.pk left join t3 on t2.pk = t3.pk where t2.num <= 2002;
select * from t1 left join t2 on t1.pk = t2.pk left join t3 on t2.pk = t3.pk;
select * from t1 left join t2 on t1.pk = t2.pk left join t3 on t2.pk = t3.pk where t2.num <= 2002;
sync_slave_with_master;
use mdev38003;
select * from t1 left join t2 on t1.pk = t2.pk left join t3 on t2.pk = t3.pk;
select * from t1 left join t2 on t1.pk = t2.pk left join t3 on t2.pk = t3.pk where t2.num <= 2002;
connection master;
use mdev38003;
drop table t1, t2, t3;
drop database mdev38003;
--echo # End of 11.8 tests
--source include/rpl_end.inc