[MDEV-32948] Bogus error message "Found wrong key definition ..; Please do "ALTER TABLE .. FORCE" to fix it!" Created: 2023-12-04  Updated: 2023-12-04

Status: Open
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Storage Engine - Archive
Affects Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2

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


 Description   

INSTALL SONAME 'ha_archive';
 
CREATE TABLE t (a DECIMAL(20) NOT NULL) ENGINE=Archive;
--error ER_CANT_CREATE_TABLE
ALTER TABLE t ADD INDEX(a);
SHOW WARNINGS;
 
# Cleanup
DROP TABLE t;
UNINSTALL SONAME 'ha_archive';

10.4 64f44b22d9a3dab3d4c0b77addbcbdafde57b466

ALTER TABLE t ADD INDEX(a);
ERROR HY000: Can't create table `test`.`t` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level	Code	Message
Note	1071	Specified key was too long; max key length is 8 bytes
Warning	1194	Found wrong key definition in t; Please do "ALTER TABLE 't' FORCE" to fix it!
Warning	1194	Found wrong key definition in t; Please do "ALTER TABLE 't' FORCE" to fix it!
Error	1005	Can't create table `test`.`t` (errno: 140 "Wrong create options")
Warning	1030	Got error 140 "Wrong create options" from storage engine ARCHIVE
DROP TABLE t;
UNINSTALL SONAME 'ha_archive';
bug.x                               [ fail ]  Found warnings/errors in server log file!
        Test ended at 2023-12-04 22:06:46
line
2023-12-04 22:06:46 4 [ERROR] Found wrong key definition in t; Please do "ALTER TABLE 't' FORCE " to fix it!
2023-12-04 22:06:46 4 [ERROR] Found wrong key definition in t; Please do "ALTER TABLE 't' FORCE " to fix it!
^ Found warnings in /mnt8t/bld/10.4-asan/mysql-test/var/log/mysqld.1.err

The actual error is ER_TOO_LONG_KEY "Specified key was too long; max key length is 8 bytes", which due to the way errors are handled is downgraded to a note and hidden behind ER_CANT_CREATE_TABLE / errno: 140 "Wrong create options".
However, 1194 Found wrong key definition in t; Please do "ALTER TABLE 't' FORCE" to fix it! which is returned as a warning to the client and written as an error in the error log is irrelevant here at all.


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