vinyl: fix crash when empty PK DDL races with DML
Vinyl doesn't support altering the primary index of a non-empty space, but the check forbidding this isn't entirely reliable - the DDL function may yield to wait for pending WAL writes to finish after ensuring that the space doesn't contain any tuples. If a new tuples is inserted into the space in the meantime, the DDL operation will proceed rebuilding the primary index and trigger a crash because the code is written on the assumption that it's rebuilding a secondary index: ``` ./src/box/vinyl.c:1572: vy_check_is_unique_secondary_one: Assertion `lsm->index_id > 0' failed. ``` Let's fix this by moving the check after syncing on WAL. Closes #10603 NO_DOC=bug fix (cherry picked from commit 955537b57c2aade58b7ca42501a9bbe50dd91f26)
Showing
- changelogs/unreleased/gh-10603-fix-vinyl-pk-alter-crash.md 4 additions, 0 deletionschangelogs/unreleased/gh-10603-fix-vinyl-pk-alter-crash.md
- src/box/vinyl.c 6 additions, 6 deletionssrc/box/vinyl.c
- test/vinyl-luatest/gh_10603_pk_alter_vs_dml_test.lua 92 additions, 0 deletionstest/vinyl-luatest/gh_10603_pk_alter_vs_dml_test.lua
Loading
Please register or sign in to comment