[MDEV-31824] Replication aborts after DDL under FOREIGN_KEY_CHECKS=OFF Created: 2023-08-01  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.5, 10.6, 10.9, 10.10, 10.11, 11.0, 11.1
Fix Version/s: 10.5, 10.6, 10.11, 11.0, 11.1

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Andrei Elkin
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I am setting it to minor, because setting foreign_key_checks=off rarely ends well with or without replication. However, since the value is stored in the binlog, it could be expected that it works the same way on the master and slave (even if it's not a good way).

--source include/have_innodb.inc
--source include/master-slave.inc
 
CREATE TABLE t1 (id INT, KEY(id)) ENGINE=InnoDB;
CREATE TABLE t2 (id INT) ENGINE=InnoDB;
SET foreign_key_checks = OFF;
ALTER TABLE t2 ADD FOREIGN KEY (id) REFERENCES t1 (id);
ALTER TABLE t1 MODIFY id BIGINT;
SET foreign_key_checks = ON;
--error ER_ERROR_ON_RENAME
ALTER TABLE t2 FORCE, ALGORITHM=COPY;
ALTER TABLE t2 MODIFY id BIGINT;
 
--sync_slave_with_master
 
# Cleanup
--connection master
DROP TABLE t2, t1;
--source include/rpl_end.inc

10.5 1a5c4c2d

Last_Error	Error 'Cannot change column 'id': used in a foreign key constraint 't2_ibfk_1'' on query. Default database: 'test'. Query: 'ALTER TABLE t2 MODIFY id BIGINT'

Reproducible on 10.5+.
The test case is not applicable to 10.4, it behaves differently under foreign_key_checks=off.


Generated at Thu Feb 08 10:26:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.