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

InMemoryLayer: move end_lsn out of the lock #4963

Merged
merged 5 commits into from
Aug 11, 2023
Merged

Conversation

arpad-m
Copy link
Member

@arpad-m arpad-m commented Aug 10, 2023

Problem

In some places, the lock on InMemoryLayerInner is only created to obtain end_lsn. This is not needed however, if we move end_lsn to InMemoryLayer instead.

Summary of changes

Make end_lsn a member of InMemoryLayer, and do less locking of InMemoryLayerInner. end_lsn is changed from Option<Lsn> into an OnceLock<Lsn>. Thanks to this change, we don't need to lock any more in three functions.

Part of #4743 . Suggested in #4905 (comment) .

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • Do we need to implement analytics? if so did you add the relevant metrics to the dashboard?
  • If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section.

Checklist before merging

  • Do not forget to reformat commit message to not include the above checklist

@arpad-m arpad-m requested review from a team as code owners August 10, 2023 15:21
@arpad-m arpad-m requested review from conradludgate, koivunej and hlinnaka and removed request for a team August 10, 2023 15:21
@github-actions
Copy link

github-actions bot commented Aug 10, 2023

1584 tests run: 1509 passed, 0 failed, 75 skipped (full report)


The comment gets automatically updated with the latest test results
9d91ddc at 2023-08-11T15:22:40.086Z :recycle:

@arpad-m
Copy link
Member Author

arpad-m commented Aug 11, 2023

I've pushed a new version now that uses OneLock, and addressed all the review comments.

@arpad-m arpad-m merged commit 9ffccb5 into main Aug 11, 2023
28 checks passed
@arpad-m arpad-m deleted the arpad/inmemory_layer_end_lsn branch August 11, 2023 16:01
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.

3 participants