Speed up secondary DB open by avoiding point-in-time MANIFEST recovery#14815
Open
dungeon-master-666 wants to merge 1 commit into
Open
Speed up secondary DB open by avoiding point-in-time MANIFEST recovery#14815dungeon-master-666 wants to merge 1 commit into
dungeon-master-666 wants to merge 1 commit into
Conversation
Author
|
@anand1976 @jowlyzhang can you take a look please? currently secondary mode is hardly usable on long-running rocksdb instances, it takes minutes to open. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Speed up
DB::OpenAsSecondary()by avoiding point-in-time MANIFEST recovery on the initial secondary open whenbest_efforts_recoveryis disabled.The initial secondary recovery now replays the MANIFEST with a regular
VersionEditHandlerto build the final Version directly, verifies that all live SST files referenced by the recovered Version are present and have the expected size, and then initializesManifestTailerfrom that recovered state for subsequent catch-up reads.Motivation
Since #12928, secondary recovery goes through
ManifestTailer, whose point-in-time recovery path tracks found/missing/intermediate files while replaying the MANIFEST. On large or long-lived MANIFEST files this can make opening a secondary DB take minutes.This matches the regression reported in #14117, where opening as secondary is much slower than opening the same DB read-only.
Changes
ReactiveVersionSet::Recover().ManifestTailerbehavior forbest_efforts_recovery.Status::TryAgain().ManifestTailerafter fast recovery so laterReadAndApply()calls continue tailing from the recovered state.ManifestTailer.Testing
Added
ReactiveVersionSetRecoverTestcoverage for:TryAgain;