Skip to content

Modernize SnapshotDeletionPolicy and PersistentSnapshotDeletionPolicy - #16482

Open
gsmiller wants to merge 3 commits into
apache:mainfrom
gsmiller:GH/delete-policy-tidy-pr
Open

Modernize SnapshotDeletionPolicy and PersistentSnapshotDeletionPolicy#16482
gsmiller wants to merge 3 commits into
apache:mainfrom
gsmiller:GH/delete-policy-tidy-pr

Conversation

@gsmiller

@gsmiller gsmiller commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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:

  1. Move from java.util maps to hppc maps for primitive typing
  2. Small modernizations to be more idiomatic with newer JVMs
  3. Marking more methods synchronized (e.g., PersistentSnapshotDeletionPolicy#getLastSaveFile could technically have a race condition).
  4. Adding consistent error recovery logic to PersistentSnapshotDeletionPolicy#release(long)
  5. Tightening up the logic in PersistentSnapshotDeletionPolicy#loadPriorSnapshots to 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.experimentaland 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).

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.

1 participant