[MDEV-15471] Assertion `new_clustered == ctx->need_rebuild()' failed in ha_innobase::commit_inplace_alter_table Created: 2018-03-05 Updated: 2023-04-27 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Storage Engine - InnoDB |
| Affects Version/s: | 10.3.3, 10.3, 10.4 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Oleksandr Byelkin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | crash, fulltext, online-ddl | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
https://api.travis-ci.org/v3/job/348679822/log.txt
Not reproducible right away |
| Comments |
| Comment by Elena Stepanova [ 2018-04-06 ] | ||||||||||||||||||||||||||||||||
|
New occurrence on 10.3: https://api.travis-ci.org/v3/job/361732380/log.txt | ||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2018-05-06 ] | ||||||||||||||||||||||||||||||||
|
New occurrence: https://api.travis-ci.org/v3/job/375320577/log.txt | ||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2018-09-04 ] | ||||||||||||||||||||||||||||||||
|
Reproducible on 10.3 39c6775a3514d0e7edff9e9,
| ||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-03-22 ] | ||||||||||||||||||||||||||||||||
|
In dt.7z The assertion is saying that all partitions should be either rebuilt or modified in-place, but a mixture is not allowed. Unrelated to this test case, which hints that something has been broken in an earlier ALTER TABLE operation, the assertion may be wrong. With operations that increment innodb_instant_alter_column and avoid a table rebuild by abandoning the canonical format, it could happen that some partitions avoid a rebuild, while others will use an instantaneous operation. Hence, we should evaluate ctx->need_rebuild() for every partition separately. The hidden indexed column FTS_DOC_ID can never be added without rebuilding the table, though. Does this assertion really not fail on 10.2? | ||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-03-22 ] | ||||||||||||||||||||||||||||||||
|
I am afraid that the logic that all partitions must be rebuilt, or all must not be rebuilt, is very hard-wired. For the rebuild case, an InnoDB internal transaction object would be allocated for the first partition already. Lifting that restriction would require changes to the way how ha_innobase::prepare_inplace_alter_table() is invoked on partitioned tables. We would need some kind of ‘atomic prepare’, just like we have the ‘atomic commit’ where ha_innobase::commit_inplace_alter_table() is invoked only once. Also, the actual transaction commit is more complex for the ‘rebuild’ phase, because it requires extra calls to fil_mtr_rename_log(). This code would be removed in elenst or alice, can you please try to find out which ALTER TABLE operations were attempted to be executed on the partitioned table before the crashing one? | ||||||||||||||||||||||||||||||||
| Comment by Matthias Leich [ 2019-03-22 ] | ||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||
| Comment by Thirunarayanan Balathandayuthapani [ 2019-10-01 ] | ||||||||||||||||||||||||||||||||
|
The following test case repeats the issue without system versioning:
The following commit enables the full text index in partition (10.3.3):
InnoDB doesn't drop FTS_DOC_ID and FTS_DOC_ID_INDEX even if all fts indexes are dropped. So when new partition is added, TABLE object The following patch disables the FULL_TEXT flag for partition. It is used for testing purpose only as of now.
Matthias can use the above patch to disable FTS in partition. | ||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-10-01 ] | ||||||||||||||||||||||||||||||||
|
The assertion is failing, because the native ALTER TABLE in InnoDB is based on the assumption that each partition of the table has equivalent schema and therefore the ALTER TABLE will invoke a similar operation on each partition. In the test case, some partitions would require rebuilding (to add a hidden FTS_DOC_ID column that is not visible in TABLE_SHARE) while others could be modified in-place, just to add the FULLTEXT INDEX. An easy fix could be to ensure that fulltext indexes remain disabled on partitioned InnoDB tables. A more complex fix would be to rewrite all ALTER TABLE code in some way that guarantees that each partition inside InnoDB will be created in the same way. It might be sufficient to do this for ADD PARTITION and similar operations. If we do that, some tests for fulltext search with partitioned InnoDB tables should be added to the regression test suite, and the fix should be extensively tested with RQG. |