[MDEV-32527] Server aborts during alter operation when table doesn't have foreign index Created: 2023-10-20  Updated: 2023-10-20  Resolved: 2023-10-20

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.4.31, 10.5.22, 10.6.15, 10.10.6, 10.11.5, 11.0.3, 11.1.2, 11.2.1, 11.3.0
Fix Version/s: 10.4.32, 10.5.23, 10.6.16, 10.10.7, 10.11.6, 11.0.4, 11.1.3, 11.2.2

Type: Bug Priority: Major
Reporter: Thirunarayanan Balathandayuthapani Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-31086 MODIFY COLUMN can break FK constraint... Closed

 Description   

InnoDB fails to find the foreign key index for the foreign key relation
in the table while iteration the foreign key constraints.
This is caused by commit 5f09b53bdb4e973e7c7ec2c53a24c98321223f98 (MDEV-31086).

Test case to repeat the issue:

--source include/have_innodb.inc
SET FOREIGN_KEY_CHECKS=0;
CREATE TABLE t1 (f1 INT NOT NULL, INDEX(f1)) ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, f2 VARCHAR(100) DEFAULT NULL,
                INDEX idx(f1, f2),
                FOREIGN KEY(f1) REFERENCES t1(f1))ENGINE=INNODB;
ALTER TABLE t2 DROP INDEX idx;
ALTER TABLE t2 MODIFY f2 VARCHAR(1023);
DROP TABLE t2, t1;

Fix:
===
In check_col_is_in_fk_indexes(), while iterating through
the foreign key relationship, InnoDB should consider that
foreign key relation may not have foreign index when
foreign key check is disabled.



 Comments   
Comment by Thirunarayanan Balathandayuthapani [ 2023-10-20 ]

Patch is in st-10.4-thiru

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