Skip to content

Remove most uses of boolean success from IndexWriter and ReadersAndUpdates#14668

Merged
ChrisHegarty merged 3 commits intoapache:mainfrom
thecoop:indexwriter-success
May 29, 2025
Merged

Remove most uses of boolean success from IndexWriter and ReadersAndUpdates#14668
ChrisHegarty merged 3 commits intoapache:mainfrom
thecoop:indexwriter-success

Conversation

@thecoop
Copy link
Contributor

@thecoop thecoop commented May 14, 2025

Followon from #14633 - refactor uses of success and success2 booleans

@github-actions
Copy link
Contributor

This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog-check label to it and you will stop receiving this reminder on future updates to the PR.

@thecoop
Copy link
Contributor Author

thecoop commented May 14, 2025

I've taken the opportunity to add the exception to logged messages, now it's accessible at the point the message is created. I'm not sure if this is something that should be in those messages though.

}
if (infoStream.isEnabled("IW")) {
infoStream.message("IW", "hit exception updating document: " + t);
}
Copy link
Contributor

@dweiss dweiss May 15, 2025

Choose a reason for hiding this comment

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

I've tried to review this but the number of possibilities is, ahem, large. Some of these changes are not strictly equivalent, even if it's highly theoretical to hit such paths. For example, in the change above, if tragicEvent throws an exception (info stream may cause it), previously it'd still run finally, now it won't. If there is a regression somewhere, it'll be fun debugging it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've modified onTragicEvent to ensure it doesn't throw, and any throwables are suppressed (if possible). This does leave the case that an assertion failure when tragedy is null will throw an AssertionError that now doesn't call the cleanup - but that assertion should never be hit outside of tests with new modifications to existing code.

@github-actions
Copy link
Contributor

This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog-check label to it and you will stop receiving this reminder on future updates to the PR.

@thecoop thecoop force-pushed the indexwriter-success branch from ee9a65b to 39c25df Compare May 15, 2025 15:57
@github-actions
Copy link
Contributor

This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog-check label to it and you will stop receiving this reminder on future updates to the PR.

@github-actions
Copy link
Contributor

This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog-check label to it and you will stop receiving this reminder on future updates to the PR.

@ChrisHegarty ChrisHegarty merged commit 0a4a76f into apache:main May 29, 2025
7 checks passed
@thecoop thecoop deleted the indexwriter-success branch June 3, 2025 08:35
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.

4 participants