Repository navigation
SOLR-18557: Restore source collection when REINDEXCOLLECTION cleanup fails - #5186
Merged
Merged
Conversation
…fails If deleting the target or checkpoint collection threw during cleanup (for example because an alias references the target), the readOnly reset and the reindexing state removal were skipped, leaving the source collection read-only. Run them in a finally block so the source is always restored, and keep rethrowing the delete error.
Contributor
|
after starting two nodes bin/solr start -e cloud, this script gave on main the error, and passed with this patch |
epugh
approved these changes
Oct 20, 2026
epugh
left a comment
Contributor
There was a problem hiding this comment.
LGTM after manual testing.
Contributor
Author
|
Thanks for testing it manually with a real cluster, @epugh, much appreciated! |
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.
https://issues.apache.org/jira/browse/SOLR-18557
Description
When a REINDEXCOLLECTION is aborted or fails,
cleanup()deletes the target and checkpoint collections before it turns readOnly off on the source and removes the reindexing state. If deleting the target throws (for example, because an alias references it), the source collection stays read-only.Solution
The readOnly reset and
removeReindexingStatenow run in afinallyblock, so the source collection is restored even if the temporary collections can't be deleted. The delete error is still rethrown, so the async request is still reported as failed with the alias message.Most of the diff is re-indentation; viewing it with "Hide whitespace" shows the actual change.
Notes:
<source> -> <target>alias can also block the delete if a failure happens after it is created. This PR restores the source in that case too, but it doesn't remove that alias; whether cleanup should undo it seems like a separate question.finallysemantics). I kept it simple since the reset is the more important failure to surface.Tests
Added
ReindexCollectionTest.testAbortWithAliasedTarget:The test fails on main ("source collection is in wrong state", with "is part of aliases" in the log) and passes with the fix. All 7 tests in
ReindexCollectionTestpass, and so does./gradlew :solr:core:check -x test.Checklist
mainbranch../gradlew check.