Modernize SnapshotDeletionPolicy and PersistentSnapshotDeletionPolicy - #16482
Open
gsmiller wants to merge 3 commits into
Open
Modernize SnapshotDeletionPolicy and PersistentSnapshotDeletionPolicy#16482gsmiller wants to merge 3 commits into
gsmiller wants to merge 3 commits into
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.
Description
I bundled some modernization/cleanup changes here as I saw opportunities while going through this code for another project I'm working on. I think it's worth a modernization pass on this code (much of it is 13 years old). Also (semi-selfishly), since I've been away from Lucene for a few months, I'm using this as an opportunity to get my hands dirty again.
This change includes:
PersistentSnapshotDeletionPolicy#getLastSaveFilecould technically have a race condition).PersistentSnapshotDeletionPolicy#release(long)PersistentSnapshotDeletionPolicy#loadPriorSnapshotsto only read from the latest ref-count file (and to ensure all older files are cleaned up, not relying on the order the filenames are read from the directory).NOTE: This is technically API-breaking since it changes the datatype of protected fields in
SnapshotDeletionPolicy. Given that this is tagged as@lucene.experimental—and given that I don't imagine lots of subclasses in the wild out there (along with the fact that it's an easy migration path in code)—I think it's reasonable to release with 10.6 instead of waiting for 11.0 (but open to feedback of course).