Uh oh!
There was an error while loading. Please reload this page.
fix: no-op on already-cached records in covert_insert_records_to_cache - #38
Open
Sheikh Nasrullah (snash4) wants to merge 1 commit into
Open
fix: no-op on already-cached records in covert_insert_records_to_cache#38Sheikh Nasrullah (snash4) wants to merge 1 commit into
Sheikh Nasrullah (snash4) wants to merge 1 commit into
Conversation
| } | ||
| OpType::Cache | OpType::Phantom => { | ||
| unreachable!("Base page should not have op type: {:?}", op_type); | ||
| // Already in cache state — nothing to convert. |
There was a problem hiding this comment.
Already in cache state — e.g. a page restored from a CPR snapshot that was
promoted at snapshot time, then re-promoted by a write after recovery.
Nothing to convert. Mirrors convert_cache_records_to_insert, which already handles the symmetric case as a no-op.
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 freeto 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.
Problem
After loading a CPR snapshot via
new_from_cpr_snapshot, inserts panic with:The CPR sweep captures
PageLocation::Fullpages (Cache op-types) verbatim into the BASE section of the snapshot file. After recovery those pages load asPageLocation::Basewith Cache records. The next mini-page overflow triggersupgrade_to_full_page→covert_insert_records_to_cache, which hitsunreachable!()on the existing Cache record.Fix
Change the
Cache | Phantom => unreachable!(...)arm to a no-op.A record already in the target state needs no conversion — symmetric with
convert_cache_records_to_insert, which already tolerates the equivalent case as a no-op rather than panicking.Why it is safe
Cacheis already marked;Phantomis the cache-tier form of a delete and likewise already in the intended state.Repro
The bug can be reproduced
https://github.com/snash4/bf-tree/tree/covert-panic-fix