[MDEV-25749] DROP DATABASE in InnoDB is case-insensitive Created: 2021-05-21  Updated: 2022-06-13  Resolved: 2021-07-23

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.6.2

Type: Bug Priority: Minor
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: corruption, upstream

Issue Links:
Relates
relates to MDEV-25748 DROP DATABASE drops unrelated FOREIGN... Closed
relates to MDEV-28802 DROP DATABASE still is case-insensitive Closed

 Description   

Table names are supposed to be case-sensitive on a case-sensitive file system. Alas, as noted in MDEV-25748, DROP DATABASE would seem drop InnoDB tables in a case-insensitive fashion, affecting tables in databases whose name only differs in the letter case:

diff --git a/mysql-test/suite/innodb/t/alter_foreign_crash.test b/mysql-test/suite/innodb/t/alter_foreign_crash.test
index 1952a1b30d4..b65dfa175c2 100644
--- a/mysql-test/suite/innodb/t/alter_foreign_crash.test
+++ b/mysql-test/suite/innodb/t/alter_foreign_crash.test
@@ -2,6 +2,7 @@
 --source include/have_debug_sync.inc
 # The embedded server does not support restarting.
 --source include/not_embedded.inc
+--source include/have_case_sensitive_file_system.inc
 
 --echo #
 --echo # Bug #20476395 DICT_LOAD_FOREIGNS() FAILED IN
@@ -10,6 +11,11 @@
 
 call mtr.add_suppression("InnoDB: Failed to load table");
 
+CREATE DATABASE Bug;
+CREATE TABLE Bug.parent(a SERIAL) ENGINE=INNODB;
+CREATE TABLE Bug.child(a SERIAL, FOREIGN KEY f(a) REFERENCES Bug.parent(a))
+ENGINE=INNODB;
+
 create database bug;
 use bug;
 
@@ -18,6 +24,7 @@ create table child(a serial, foreign key fk (a) references parent(a))engine=inno
 
 insert into parent values(1);
 insert into child values(1);
+drop database Bug;
 
 connect (con1,localhost,root,,bug);
 SET DEBUG_SYNC='innodb_rename_table_ready SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
@@ -32,6 +39,9 @@ disconnect con1;
 
 show tables;
 alter table parent row_format=dynamic;
-
+select * from child;
+--error ER_ROW_IS_REFERENCED_2
+drop table parent;
+drop table child;
 drop table parent;
 drop database bug;

The changed test would fail in an unexpected way (not a mere result difference):

10.2 629449172a5b0a6975663ca1ac420789e00b941d

CURRENT_TEST: innodb.alter_foreign_crash
mysqltest: At line 42: query 'select * from child' failed: 1146: Table 'bug.child' doesn't exist

Possibly we could fix this by porting the fixes of MDEV-25691 and MDEV-25748 from MariaDB Server 10.6, but it might not be a good idea because the MDEV-25691 fix removes work-arounds for the lack of atomic DDL (MDEV-17567).

Hence, even though I usually treat InnoDB corruption bugs at high priority, I am only filing this bug for documenting its existence. I do not plan to fix this, because the fix could cause more damage, and because the bug has existed for years without anyone complaining.



 Comments   
Comment by Elena Stepanova [ 2021-06-19 ]

marko,

I do not plan to fix this

Should it be closed as 'Won't fix' then? It sounds like a very good fit, given the circumstances.

Comment by Marko Mäkelä [ 2022-06-13 ]

This particular scenario was fixed in 10.6.2. One more case was reported as MDEV-28802, fixed in 10.6.9.

Generated at Thu Feb 08 09:40:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.