rolling tape optimizations - #6
Merged
Merged
Conversation
redsh4de
marked this pull request as ready for review
September 11, 2026 13:43
redsh4de
force-pushed
the
feat/o1-rolling-tape
branch
from
September 11, 2026 14:22
5fad9f8 to
2308d76
Compare
Boog900
requested changes
Sep 11, 2026
Boog900
left a comment
Member
There was a problem hiding this comment.
Just a nit and a simplification
Comment on lines
+187
to
+194
| let first_file_touched = { | ||
| let files = self.files.read(); | ||
| let slot = current_file_idx | ||
| .checked_add(1) | ||
| .map_or(files.len(), |next| slot_for(&files, next)); | ||
| slot.checked_sub(1) | ||
| .map_or(current_file_idx, |slot| files[slot].file_index) | ||
| }; |
Member
There was a problem hiding this comment.
This confused me, couldn't we just do first_file_touched: current_file_idx without all this?
Contributor
Author
There was a problem hiding this comment.
This ensures that if the current file is missing, we sync the previous one as it might not have been synced yet
Made it easier to reason about
Member
There was a problem hiding this comment.
Couldn't there be more than 1 previous file that we haven't synced yet? If we write 2 files but only buffer their writes then this will only sync one of the 2 right?
Member
There was a problem hiding this comment.
I'll merge this anyway as it is harmless
Co-authored-by: Boog900 <boog900@tutanota.com>
remove the upfront file creation, the file will be created when we actually start writing simplify the previous-file sync in writer
Boog900
approved these changes
Sep 12, 2026
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.
Rolling tapes:
writer()and commits were O(n) in the number of files. They are now O(1).read_bytesreturns an error if a file in the range does not exist. Before, it returnedOkand left part of the buffer unchanged.metadata. A rolling tape with this name could delete the database metadata.Other:
start_indexfor a new tape. Before, the cache started at 0, which could cause a panic.Behaviour changes:
metadatais rejected for every rolling tape, also when tape has its own directory.