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

storage: use Arc<Version> during pin and unpin #685

Merged
merged 1 commit into from
Aug 27, 2022
Merged

storage: use Arc<Version> during pin and unpin #685

merged 1 commit into from
Aug 27, 2022

Conversation

chaixuqing
Copy link
Contributor

Signed-off-by: chaixuqing xuqingchai00@gmail.com

close #537

Currently, we use pin and unpin manually in code. In this request, we use Arc<Version> to help us automatically unpin instead of manual code.

Signed-off-by: xuqingchai <xuqingchai00@gmail.com>
Copy link
Member

@skyzh skyzh left a comment

Choose a reason for hiding this comment

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

LGTM. Still the other idea mentioned in #549

I've another idea: we can simply using Arc to help us do reference counting, instead of maintaining the ref_cnt by ourselves. For each epoch, we associate a single Version object, and wrap it with an Arc. When a user requests pin, we clone the Arc for them. When the last Arc gets dropped, the Version object gets dropped, and we can safely remove the version.

If you're interested, welcome to implement pin / unpin in this way.

@skyzh skyzh merged commit 3184f93 into risinglightdb:main Aug 27, 2022
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.

storage: use object to pin and unpin version
2 participants