Skip to content

Check if merge is aborted before executing file integrity checks#16264

Merged
romseygeek merged 3 commits into
apache:mainfrom
tlrx:2026/06/16-check-aborted-before-integrity-checks
Jun 19, 2026
Merged

Check if merge is aborted before executing file integrity checks#16264
romseygeek merged 3 commits into
apache:mainfrom
tlrx:2026/06/16-check-aborted-before-integrity-checks

Conversation

@tlrx

@tlrx tlrx commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This pull request adds OneMerge to the MergeState so that merge writers and consumers can check the abort flag before starting each reader's checkIntegrity(). This avoids kicking off costly full-file checksums on segments when the merge has already been aborted.

Relates #16086

* The merge that this state is associated with, or {@code null} if this merge state is not
* associated with an {@link IndexWriter} merge (e.g. for addIndexes).
*/
public final MergePolicy.OneMerge oneMerge;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oneMerge is public, do we really want to expose the raw OneMerge on MergeState's public API? checkAborted() method is all the codecs need, and that's already public..making the field package-private (or at least @lucene.internal) would avoid leaking merge internals to custom codec implementations!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that's a valid point.

I added the @lucene.internal annotation in db5d684 since org.apache.lucene.codecs.perfield.PerFieldMergeState sits in a different package and requires oneMerge to be public in order to propagate it when creating a restricted MergeState.

@tlrx tlrx requested a review from iprithv June 17, 2026 07:22

@romseygeek romseygeek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, and is a nice compromise for the moment.

Can you add a CHANGES entry for 10.5?

@tlrx

tlrx commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review @romseygeek ! I pushed 4ee6459 for the change log.

@github-actions github-actions Bot added this to the 10.5.0 milestone Jun 19, 2026
@romseygeek romseygeek merged commit a34cefd into apache:main Jun 19, 2026
13 checks passed
romseygeek pushed a commit that referenced this pull request Jun 19, 2026
)

Adds OneMerge to the MergeState so that merge writers and consumers
can check the abort flag before starting each reader's checkIntegrity().
This avoids kicking off costly full-file checksums on segments when the
merge has already been aborted.
vijaykriishna pushed a commit to vijaykriishna/lucene that referenced this pull request Jun 20, 2026
…che#16264)

Adds OneMerge to the MergeState so that merge writers and consumers
can check the abort flag before starting each reader's checkIntegrity().
This avoids kicking off costly full-file checksums on segments when the
merge has already been aborted.
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.

3 participants