vinyl: don't create cache chain over unconfirmed deferred DELETE#11168
Merged
locker merged 1 commit intotarantool:masterfrom Feb 19, 2025
Merged
vinyl: don't create cache chain over unconfirmed deferred DELETE#11168locker merged 1 commit intotarantool:masterfrom
locker merged 1 commit intotarantool:masterfrom
Conversation
While scanning a non-unique secondary index of a vinyl space, we skip a tuple if there's no match for it in the primary index because it means that the tuple was overwritten by a newer statement but the secondary index DELETE was deferred until compaction. We still create a cache chain link in this case so that we skip the overwritten tuple when we scan the secondary index next time. We do it even if the overwriting statement is unconfirmed (not yet written to WAL), which is actually incorrect. The problem is that if the overwriting statement is rolled back on a WAL write error, the chain created in the secondary index cache won't be broken because nothing was actually written to the secondary index (DELETE was deferred) therefore there's nothing to roll back therefore there's nothing to invalidate the cache by. As a result, the tuple that the user attempted to delete but failed due to a WAL error will become inaccessible via the secondary index because of the stale cache chain. Fix this issue by disabling creation of a cache chain link in case the read iterator skipped an unconfirmed deferred DELETE statement. Closes tarantool#11140 NO_DOC=bug fix
nshy
approved these changes
Feb 19, 2025
xuniq
approved these changes
Feb 19, 2025
Member
Author
|
Cherry-picked to 2.11, 3.2, 3.3. |
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.
While scanning a non-unique secondary index of a vinyl space, we skip a tuple if there's no match for it in the primary index because it means that the tuple was overwritten by a newer statement but the secondary index DELETE was deferred until compaction. We still create a cache chain link in this case so that we skip the overwritten tuple when we scan the secondary index next time. We do it even if the overwriting statement is unconfirmed (not yet written to WAL), which is actually incorrect. The problem is that if the overwriting statement is rolled back on a WAL write error, the chain created in the secondary index cache won't be broken because nothing was actually written to the secondary index (DELETE was deferred) therefore there's nothing to roll back therefore there's nothing to invalidate the cache by. As a result, the tuple that the user attempted to delete but failed due to a WAL error will become inaccessible via the secondary index because of the stale cache chain.
Fix this issue by disabling creation of a cache chain link in case the read iterator skipped an unconfirmed deferred DELETE statement.
Closes #11140