Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge JournalManager, FlushManager and WriteBuffer into one FlushTracker #118

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

hummingly
Copy link

@hummingly hummingly commented Jan 3, 2025

While I was looking through the codebase to understand how transactions work, I noticed that the KeyspaceInner and PartitionHandleInner structs were somewhat "large". The JournalManager, FlushManager and WriteBuffer were always cloned together so I made the FlushTracker struct and fixed the TODOs in JournalManager and FlushManager. Then I noticed there were some redundant *Inner structs, clones and collects, and went ahead removing them were possible.

The only place I am unsure about is the SpaceTracker::allocate() method. In the original WriteBufferManager::allocate() method AtomicU64::fetch_add() was used. I instead used a loop with AtomicU64::compare_exchange().

Also I changed some fields to pub(crate) from pub with #[doc(hidden)] or were otherwise private structs.

hummingly and others added 7 commits January 1, 2025 18:07
* These data structures are always used together. Grouping them together avoids needless 2 Arc clones and saves 2 words on KeyspaceInner, Monitor and PartitionHandle on the stack.
* Removed inner struct variants if the wrapper did not add any functionality.
* Simplified item visibility.
* Replaces HashSet/Map with Vec where the results are immediately iterated over or collected into another Vec. The Vecs are guaranteed to be a set due to being derived from HashMaps.
@marvin-j97 marvin-j97 self-assigned this Jan 3, 2025
@marvin-j97 marvin-j97 removed their assignment Jan 3, 2025
* FlushTracker counter for flush tasks and journal items
src/space_tracker.rs Outdated Show resolved Hide resolved
src/flush_tracker.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants