[Remote Compaction] Set Options File Number for CompactionInput under Mutex Lock #13394
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Options File Number to be read by remote worker is part of the
CompactionServiceInput
. We've been setting this inProcessKeyValueCompactionWithCompactionService()
while the db_mutex is not held. This needs to be accessed while the mutex is held. The value can change as part ofSetOptions() -> RenameTempFileToOptionsFile()
as in following.rocksdb/db/db_impl/db_impl.cc
Lines 5595 to 5596 in e697219
Keep this value in memory during
CompactionJob::Prepare()
which is called while the mutex is held, so that we can easily access this later without mutex when building the CompactionInput for the remote compaction.Thanks to the crash test. This was surfaced after #13378 merged.
Test Plan
Unit Test
Crash Test