[MDEV-20154] Assertion `len <= col->len || ((col->mtype) == 5 || (col->mtype) == 14)' failed in row_merge_buf_add Created: 2019-07-24 Updated: 2021-07-29 Resolved: 2021-07-29 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Virtual Columns |
| Affects Version/s: | 10.2, 10.3 |
| Fix Version/s: | 10.2.40, 10.3.31, 10.4.21, 10.5.12, 10.6.4 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Nikita Malyavin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | regression | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
Important note: Even though the test case looks deterministic, the failure seems come and go. Sometimes it happens every time, dozens times in a row, and suddenly just stops and the test starts passing, with the same options and the same binaries. It seems to be more reliable with ASAN, even though it's still the same assertion failure, but maybe it's just the matter of luck.
The failure seemingly appeared in 10.2 tree after this commit:
As of now (July 24th), it's also in 10.3, but not yet in 10.4, and 10.4 does not fail. |
| Comments |
| Comment by Nikita Malyavin [ 2021-07-05 ] | ||||||
|
Setting to critical since it's a regression | ||||||
| Comment by Nikita Malyavin [ 2021-07-19 ] | ||||||
|
Commit for review: | ||||||
| Comment by Nikita Malyavin [ 2021-07-19 ] | ||||||
|
commit for review: | ||||||
| Comment by Marko Mäkelä [ 2021-07-19 ] | ||||||
|
I think that this needs to be thoroughly stress tested. Where is the 10.6 based version? | ||||||
| Comment by Nikita Malyavin [ 2021-07-19 ] | ||||||
|
marko pushed here https://github.com/MariaDB/server/commit/5ac3578488a56b94d19784eaeee77aba0584691 | ||||||
| Comment by Marko Mäkelä [ 2021-07-27 ] | ||||||
|
nikitamalyavin, I believe that we do allow ADD INDEX on a virtual column while concurrent DML is possible. The 10.6 version does not seem to address my review comments for the 10.2 version. I do not think that it is safe to modify dict_table_t::vc_templ while not holding MDL_EXCLUSIVE. We need to be prepared for a failed execution too. Please add test case scenarios that include concurrent ADD UNIQUE INDEX, and triggers a duplicate key errors:
Please refer to the test innodb.innodb-index-online, in particular the DEBUG_SYNC labels row_log_apply_before and row_log_apply_after. | ||||||
| Comment by Marko Mäkelä [ 2021-07-27 ] | ||||||
|
You may easily adapt the DEBUG_SYNC test case that I posted to MDEV-26251. | ||||||
| Comment by Nikita Malyavin [ 2021-07-27 ] | ||||||
|
I have moved the change in ha_innobase::prepare_inplace_alter_table, which is supposed to be evaluated under ecxlusive MDL lock. This is guaranteed by the check in the beginning of the function:
Patch for review: d5c8842df0e | ||||||
| Comment by Marko Mäkelä [ 2021-07-28 ] | ||||||
|
Thank you, it is clearer now. I see that we are unnecessarily constructing dict_table_t::vc_templ already for the INSERT when there do not exist any indexes on the virtual column. Because of this, we must update or invalidate dict_table_t::vc_templ when the base columns of a non-indexed virtual column are changed (in the first ALTER TABLE statement). Please make this clear in the commit message. Initially, I thought that the fix would apply to the second ALTER TABLE statement. That is why I initially asked to cover a failed ALTER TABLE in the test case. That should not actually be necessary, because the fix only affects the first ALTER TABLE (metadata-only change) and it does not matter whether that operation will succeed or be rolled back. While I do not see a problem with the updated solution, to be on the safe side, I think that it would be good to subject this to additional stress testing before pushing. Related to the second ALTER TABLE statement, I do not completely understand the pre-existing logic in ha_innobase::inplace_alter_table() for updating dict_table_t::vc_templ. It would seem to me that there are race conditions with concurrently executed DML. Isn’t the s_templ only supposed to be used by the ALTER TABLE thread, and not by concurrently running DML operations? Wouldn’t it be safer to avoid updating dict_table_t::vc_templ before the transaction is committed, and make CREATE INDEX use its own private data structure? Maybe you can file a separate ticket for that? | ||||||
| Comment by Nikita Malyavin [ 2021-07-28 ] | ||||||
|
marko I am not sure whether vc_templ is first created on CREATE TABLE, or on INSERT | ||||||
| Comment by Nikita Malyavin [ 2021-07-28 ] | ||||||
|
New patch is: https://github.com/MariaDB/server/commit/3817d067f9bc51191e302887534576bf4903fe28 | ||||||
| Comment by Nikita Malyavin [ 2021-07-28 ] | ||||||
|
Marko: New patch is: https://github.com/MariaDB/server/commit/e7e8a2daa86e40c53eeaee81e0ccb9735ed9584c | ||||||
| Comment by Nikita Malyavin [ 2021-07-28 ] | ||||||
|
10.6 version: | ||||||
| Comment by Marko Mäkelä [ 2021-07-28 ] | ||||||
|
Thank you, this looks OK from my point of view. Let us wait for the test results from mleich. |