Fix loss of root/meta blkno after self-invalidation; defer invalidation processing under page locks#55
Open
Serge-sudo wants to merge 1 commit intoorioledb:patches17from
Conversation
82c6a25 to
b8d017d
Compare
…on processing under page locks Fix an issue where B-tree descriptor state (`metaPageBlkno` and `rootPageBlkno`) could be lost after processing an invalidation message within the same transaction. Previously, after `o_btree_load_shmem()` initialized the descriptor, a invalidation message could be processed before the descriptor was used. This caused the descriptor to be recreated, resetting `metaPageBlkno` and `rootPageBlkno` to `InvalidBlockNumber`, which led to assertion failures (e.g. in `btree_ctid_get_and_inc`). While investigating, another problem was identified: invalidation message processing may occur while holding page locks. Invalidation handlers access system trees, and if required pages are evicted, they trigger page loads. This leads to `load_page()` being called while locks are held, hitting assertions that forbid holding locks during page load. To address both issues: * Ensure descriptor state is not lost due to mid-operation self-invalidation * Introduce deferred invalidation handling: * Skip invalidation message processing when it is unsafe (e.g. while holding page locks) * Process pending invalidation messages at the next safe point This prevents descriptor corruption and avoids unsafe page loads under locks.
b8d017d to
2c21d4d
Compare
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.
Fix an issue where B-tree descriptor state (
metaPageBlknoandrootPageBlkno) could be lost after processing an invalidation message within the same transaction.Previously, after
o_btree_load_shmem()initialized the descriptor, a invalidation message could be processed before the descriptor was used. This caused the descriptor to be recreated, resettingmetaPageBlknoandrootPageBlknotoInvalidBlockNumber, which led to assertion failures (e.g. inbtree_ctid_get_and_inc).While investigating, another problem was identified: invalidation message processing may occur while holding page locks. Invalidation handlers access system trees, and if required pages are evicted, they trigger page loads. This leads to
load_page()being called while locks are held, hitting assertions that forbid holding locks during page load.To address both issues:
Ensure descriptor state is not lost due to mid-operation self-invalidation
Introduce deferred invalidation handling:
This prevents descriptor corruption and avoids unsafe page loads under locks.
downlink -> orioledb/orioledb#792