feat: add scatter write benchmark#92
Merged
Merged
Conversation
1. fopen O_APPEND bug: opening with 'a'/'a+' used fopen("ab+") which
enables O_APPEND, causing every fwrite to go to EOF regardless of
fseek. The library manages offsets via fseek+fwrite, so 'a' must
map to "rb+" (with "wb+" fallback for file creation).
2. btree is_readonly for 'r+': btree was constructed with
is_readonly=(mode_b & mode_bit::r), which is true for 'r+' since
both r and plus bits are set. read_child() then called
child.unmodify() preventing btree updates from being persisted to
disk — scatter writes silently lost their index updates.
Fix: is_readonly is true only for pure 'r' without '+', 'w', or 'a'.
3. defragmentation mid-flush: allocator::deallocate() triggers
maintenance() every 64 deallocs, which calls perform_defragmentation()
from within block::~block() during clear_cache(). At that point the btree index is only partially updated — remaining unflushed blocks
still have stale addresses. Defrag read garbage data and corrupted
the archive. Fix: pass perform_maintenance=false in the destructor.
Co-authored-by: mozhaa <mozhay2005@gmail.com>
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.
No description provided.