box: handle consequent DDL operations#10559
Merged
locker merged 2 commits intotarantool:masterfrom Oct 18, 2024
drewdzzz:ddl_crashes
Merged
box: handle consequent DDL operations#10559locker merged 2 commits intotarantool:masterfrom drewdzzz:ddl_crashes
locker merged 2 commits intotarantool:masterfrom
drewdzzz:ddl_crashes
Conversation
locker
requested changes
Sep 13, 2024
xuniq
approved these changes
Sep 23, 2024
locker
reviewed
Sep 24, 2024
locker
reviewed
Oct 16, 2024
locker
reviewed
Oct 17, 2024
Yielding DDL operations acquire DDL lock so that the space cannot be modified under its feet. However, there is a case when it actually can: if a yielding DDL has started when there is another DDL is being committed and it gets rolled back due to WAL error, `struct space` created by rolled back DDL is deleted - and it's the space being altered by the yielding DDL. In order to fix this problem, let's simply wait for all previous alters to be committed. We could use `wal_sync` to wait for all previous transactions to be committed, but it is more complicated - we need to use `wal_sync` for single instance and `txn_limbo_wait_last_txn` when the limbo queue has an owner. Such approach has more pitfalls and requires more tests to cover all cases. When relying on `struct alter_space` directly, all situations are handled with the same logic. Alternative solutions that we have tried: 1. Throw an error in the case when user tries to alter space when there is another non-committed alter. Such approach breaks applier since it applies rows asynchronously. Trying applier to execute operations synchronously breaks it even harder. 2. Do not use space in `build_index` and `check_format` methods. In this case, there is another problem: rollback order. We have to rollback previous alters firstly, and the in-progress one can be rolled back only after it's over. It breaks fundamental memtx invariant: rollback order must be reverse of replace order. We could try to use `before_replace` triggers for alter, but the patch would be bulky. Closes #10235 NO_DOC=bugfix
Since we often search spaces, users, funcs and so on in internal caches that have `read-committed` isolation level (prepared tuples are seen), let's always allow to read prepared tuples of system spaces. Another advantage of such approach is that we never handle MVCC when working with system spaces, so after the commit they will behave in the same way - prepared tuples will be seen. The only difference is that readers of prepared rows will be aborted if the row will be rolled back. By the way, the inconsistency between internal caches and system spaces could lead to crash in some sophisticated scenarios - the commit fixes this problem as well because now system spaces and internal caches are synchronized. Closes #10262 Closes tarantool/security#131 NO_DOC=bugfix
locker
approved these changes
Oct 17, 2024
Serpentian
approved these changes
Oct 17, 2024
Contributor
Serpentian
left a comment
There was a problem hiding this comment.
Thank you for the patch! No objections
Member
|
Cherry-picked to 2.11 and 3.2. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The patch fixes a crash with consequent DDL operations when MVCC is disabled and an unexplainable error when MVCC is enabled.
Closes #10235
Closes #10262
Closes tarantool/security#131