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

RCORE-2059 Truncate the metadata realm in-place rather than deleting and recreating it #7526

Merged
merged 3 commits into from Apr 3, 2024

Conversation

tgoyne
Copy link
Member

@tgoyne tgoyne commented Mar 26, 2024

This solves some locking problems in multi-process scenarios. The flow of checking if the key is valid, deleting the file if not, and then recreating the file if needed needs to be done with an exclusive lock on the file held. This can't be done with DB::call_with_lock() because there isn't a good way to initialize the new file from within the call_with_lock() callback, and instead needs to be pushed into the file initialization guarded by the control mutex.

This maps and reads from the file before the call to note_reader_start(). I think this is fine because it's just validating the header and then unmapping, but I'm not completely sure?

…ing it

This solves some locking problems in multi-process scenarios. The flow of
checking if the key is valid, deleting the file if not, and then recreating the
file if needed needs to be done with an exclusive lock on the file held. This
can't be done with DB::call_with_lock() because there isn't a good way to
initialize the new file from within the call_with_lock() callback, and instead
needs to be pushed into the file initialization guarded by the control mutex.
@tgoyne tgoyne self-assigned this Mar 26, 2024
@cla-bot cla-bot bot added the cla: yes label Mar 26, 2024
Copy link

coveralls-official bot commented Mar 26, 2024

Pull Request Test Coverage Report for Build thomas.goyne_257

Details

  • 270 of 270 (100.0%) changed or added relevant lines in 9 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.07%) to 92.225%

Totals Coverage Status
Change from base Build 2186: 0.07%
Covered Lines: 246274
Relevant Lines: 267035

💛 - Coveralls

Copy link
Contributor

@finnschiermer finnschiermer left a comment

Choose a reason for hiding this comment

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

I took the liberty to move the call to note_reader_start() up, just to be on the safe side.

LGTM.

@tgoyne tgoyne merged commit 467eafe into master Apr 3, 2024
36 of 38 checks passed
@tgoyne tgoyne deleted the tg/reset-metadata-realm branch April 3, 2024 15:20
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants