[MDEV-27216] Bogus "Incorrect information in file" upon failed attempt to add a long unique key Created: 2021-12-10  Updated: 2021-12-10

Status: Open
Project: MariaDB Server
Component/s: Virtual Columns
Affects Version/s: 10.4
Fix Version/s: 10.4

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Nikita Malyavin
Resolution: Unresolved Votes: 0
Labels: not-10.5, not-10.6, not-10.7


 Description   

CREATE TABLE t (id INT AUTO_INCREMENT, a VARCHAR(1024), PRIMARY KEY(id)) ENGINE=MyISAM;
ALTER TABLE t ADD UNIQUE(id,a);

Since the commit below, the ALTER fails. Judging by the commit comment, it's intentional.

10.4 d352bc5b

mysqltest: At line 2: query 'ALTER TABLE t ADD UNIQUE(id,a)' failed: 1901: Function or expression 'AUTO_INCREMENT' cannot be used in the USING HASH clause of `id`

commit 1fdac574470a5103dde689c8ce65041487e77f2c (origin/bb-10.4-nikita)
Author: Nikita Malyavin
Date:   Thu Oct 28 03:37:23 2021 +0300
 
    MDEV-26453 Assertion `0' failed in row_upd_sec_index_entry & corruption
    
    Long UNIQUE HASH index silently creates virtual column index, which should
    be impossible for base columns featuring AUTO_INCREMENT.
    
    Fix: add a relevant check; add new vcol type for a prettier error message.

However, on 10.4, in addition to the error returned in the client, there is also an error written to the log:

2021-12-10  3:48:48 4 [ERROR] mysqld: Incorrect information in file: './test/#sql-2588c5_4.frm'

This error typically indicates corruption which in this case is (hopefully) a false alarm. If so, it shouldn't be there.

It doesn't happen on 10.5+, only on 10.4. Maybe it's related to 10.5+ returning a different error upon ALTER, ER_NO_AUTOINCREMENT_WITH_UNIQUE instead of ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED.


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