[MDEV-15885] Wrong error message to ALTER TABLE ... ADD KEY ... Created: 2018-04-16 Updated: 2020-12-17 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Locking |
| Affects Version/s: | 10.2.15 |
| Fix Version/s: | 10.2 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Matthias Leich | Assignee: | Vladislav Vaintroub |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | ddl, mdl | ||
| Environment: |
Linux: openSUSE 42.3 (x86_64) – IMHO not important |
||
| Attachments: |
|
| Description |
|
Source: My test
After some time (you might need several test runs)
Protocols of the concurrent sessions:
IMHO the bug itself isn't that important because
|
| Comments |
| Comment by Matthias Leich [ 2018-04-16 ] | |||||||||||||||||||
|
How to use the archive? cd <tree>/mysql-test ./mtr --mem ml001 Please just ignore the majority of test output. MTR's internal check of the test case 'main.ml001' failed. | |||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-04-17 ] | |||||||||||||||||||
|
The error 'index is corrupted' is technically correct, but it would be nicer to report 'duplicate key error' in this particular case. The following scenario is possible:
Note that secondary indexes will be created one at a time. If multiple indexes are created, the first ones would be directly updated by concurrent DML while some indexes are still being created. Also, uncommitted added indexes would be directly updated by DML while the MDL upgrade is in progress, so that the ALTER TABLE would be committed. At least in some cases, the corrupted index would be reported as a duplicate key. Here is an excerpt from the 10.0 innodb.innodb-index-online test:
| |||||||||||||||||||
| Comment by Matthias Leich [ 2018-04-17 ] | |||||||||||||||||||
|
I am aware of the complexity but have also problems to agree with the report 'duplicate key error'.
| |||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-04-17 ] | |||||||||||||||||||
|
I did not realize that there are multiple concurrent DDL on the table. I was under the impression that multiple DDL would be prevented by metadata lock (MDL), also during the time when online ALTER has downgraded the metadata lock. In that case, this would not be an InnoDB bug, but a bug in MDL. | |||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-04-24 ] | |||||||||||||||||||
|
The problem is that a running ALTER TABLE is not preventing another ALTER TABLE from being attempted on the same table. |