[MDEV-23508] Unexpected corruption error ER_NOT_KEYFILE upon ALTER TABLE with a certain combination of data volume and max_sort_file_size Created: 2020-08-18  Updated: 2023-08-24  Resolved: 2023-08-24

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Aria, Storage Engine - MyISAM
Affects Version/s: 10.1, 10.2, 10.3
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Won't Fix Votes: 0
Labels: not-10.4, not-10.5


 Description   

I am setting it to Minor, despite it being a corruption-looking error, because it is only reproducible on 10.1-10.3, apparently something has fixed it in 10.4+. Besides, it requires a non-default value of myisam_max_sort_file_size / aria_max_sort_file_size.

--source include/have_sequence.inc
 
CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (8,8);
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_100000;
 
SET GLOBAL myisam_max_sort_file_size= 1024*1024;
ALTER TABLE t1 MODIFY b INT NOT NULL;
 
--error ER_DUP_ENTRY
ALTER TABLE t1 ADD UNIQUE (b);
 
# Cleanup
DROP TABLE t1;

10.2 5f1ec5cb

MariaDB [test]> ALTER TABLE t1 ADD UNIQUE (b);
ERROR 1034 (HY000): Duplicate key  1 for record at 72 against new record at 0

There is indeed a duplicate key in the table, but it should be error 1062 - ER_DUP_ENTRY, not 1034 - ER_NOT_KEYFILE.

The printed duplicate key value is also wrong, possibly related to MDEV-23507.

The problem seems to be scalable, myisam_max_sort_file_size value required to reproduce it depends on the data volume.

Also reproducible with Aria:

--source include/have_sequence.inc
 
CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE=Aria;
INSERT INTO t1 VALUES (8,8);
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_100000;
 
SET GLOBAL aria_max_sort_file_size= 0;
ALTER TABLE t1 MODIFY b INT NOT NULL;
 
--error ER_DUP_ENTRY
ALTER TABLE t1 ADD UNIQUE (b);
 
# Cleanup
DROP TABLE t1;



 Comments   
Comment by Elena Stepanova [ 2023-08-24 ]

10.3 is EOL

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