fix(db): clean up retired segment directories on Windows - #676
Open
JalinWang wants to merge 3 commits into
Open
Conversation
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.
Closes #644.
External handle case
In the uncommon case where another process, such as a backup or inspection tool, opens a segment file on Windows without
FILE_SHARE_DELETE,Optimize()cannot immediately remove the old directory.The optimization remains successful because the replacement segment and manifest are already committed. The leftover directory will be removed on a later read-write open by the recovery cleanup introduced in #674, after the external handle is released.
Linux normally does not encounter this case because an open or memory-mapped file can still be unlinked; its storage is reclaimed after the last reference is closed.
Tests: targeted
collection_testcases pass on Windows.