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

Reduce unnecessary MutableCFOptions copies and parameters #13301

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pdillinger
Copy link
Contributor

Summary: As follow-up to #13239, this change is primarily motivated by simplifying the calling conventions of LogAndApply. Since it must be called while holding the DB mutex, it can read safely read cfd->GetLatestMutableCFOptions(), until it releases the mutex within ProcessManifestWrites. Before it releases the mutex, it makes a copy of the mutable options in a new, unpublished Version object, which can be used when not holding the DB mutex. This eliminates the need for callers of LogAndApply to copy mutable options for its sake, or even specify mutable options at all. And it eliminates the need for another copy to be saved in ManifestWriter.

Other functions that don't need the mutable options parameter:

  • ColumnFamilyData::CreateNewMemtable()
  • CompactionJob::Install() / InstallCompactionResults()
  • MemTableList::InstallMemtable()
  • Version::PrepareAppend()

Test Plan: existing tests, CI with sanitizers

Summary: As follow-up to facebook#13239, this change is primarily motivated by
simplifying the calling conventions of LogAndApply. Since it must be
called while holding the DB mutex, it can read safely read
cfd->GetLatestMutableCFOptions(), until it releases the mutex. Before it
releases the mutex, it makes a copy of the mutable options in a new,
unpublished Version object, which can be used when not holding the DB
mutex. This eliminates the need for callers of LogAndApply to copy
mutable options for its sake, or even specify mutable options at all.
And it eliminates the need for *another* copy saved in ManifestWriter.

Other functions that don't need the mutable options parameter:
* ColumnFamilyData::CreateNewMemtable()
* CompactionJob::Install() / InstallCompactionResults()
* MemTableList::*InstallMemtable*()
* Version::PrepareAppend()

Test Plan: existing tests, CI with sanitizers
@facebook-github-bot
Copy link
Contributor

@pdillinger has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants