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

Separate orphan storage #32

Merged
merged 2 commits into from
Jun 6, 2023
Merged

Separate orphan storage #32

merged 2 commits into from
Jun 6, 2023

Conversation

codchen
Copy link
Contributor

@codchen codchen commented May 30, 2023

Describe your changes and provide context

Add a new option that stores orphan separate from the main application data to maximize data locality for orphan data which, for a given version, is always read and written together. It also removes the need for expensive calls like getPreviousVersion so that the overall latency is further improved.

Specifically, if this option is on, orphan data would be stored as plain files cataloged by the committing version that resulted in the orphans, and also cached in memory. Most of the time, orphans will be read from the memory and used to delete obsolete data in the application DB, after which the corresponding orphan version directory will be removed as a whole. In the rare event of crash or process restarts, orphan data would be read from the orphan files.

Testing performed to validate your change

unit test & testing on atlantic-2

@codchen codchen requested review from philipsu522 and yzang2019 June 5, 2023 03:46
@codchen codchen changed the title no orphan multi version Separate orphan storage Jun 5, 2023
@@ -951,12 +965,44 @@ func (tree *MutableTree) saveFastNodeVersion() error {
return tree.ndb.setFastStorageVersionToBatch()
}

func (tree *MutableTree) handleOrphans(version int64) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this function threadsafe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not threadsafe, but it would not run concurrently

@codchen codchen merged commit 799c1de into main Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants