Repository navigation
SOLR-18589: Lock the resolved collection when followAliases=true - #5255
sarkaramrit1993 wants to merge 2 commits into
Conversation
Commands that carry an alias name with followAliases=true resolved the alias only inside the command, after locking on the alias name. Resolve it before taking the lock, in both Overseer and distributed modes.
|
Hi Amrit, 🤖 AI text below 🤖 (reviewed by Nick Shanin) I found two follow-up cases while reviewing this and prepared [fixes and regression tests](nick-boss-tech/solr@1edd6a1...52dacc2):
At With the original production code and the new tests, four tests fail and two controls pass. The queued alias-retargeting test fails by timing out waiting for FAILED; it does not record the final async state. The tested head is a fast-forward of this PR’s current head. To take the changes: git switch alias-lock-key-18589
git fetch https://github.com/nick-boss-tech/solr.git solr-18589-submit
git merge --ff-only 52dacc23b5bb67d254c111c948733da7bc4a9f81 |
…fails A multi-collection alias with followAliases=true is rejected while taking the lock. The Overseer stored that error as a plain string, so clients got a ClassCastException (500) instead of the intended 400.
|
Thanks. Took the Overseer error-response fix in 70aafad. Leaving the alias-retarget-during-lock-wait case out of this PR; it predates this change and needs alias updates to coordinate with collection locks. |
|
Looks good. 2 comments: |
|
Dropped REINDEXCOLLECTION from the description; it's LockLevel.NONE so this change doesn't apply to it. |
Description
SOLR-18589: Collection API commands sent with
followAliases=truecarry the alias name, and the command resolves it only insidecall(), after the lock was taken on the alias name. SoDELETEREPLICA collection=myAlias&followAliases=truedoesn't serialize with a concurrent command on the real collection. This affects DELETE, DELETESHARD, DELETEREPLICA, SPLITSHARD, MOVEREPLICA, MIGRATE and RENAME, in both Overseer and distributed modes.Solution
Resolve the alias before computing the lock key (
CollectionHandlingUtils.lockCollectionName), inOverseerCollectionMessageHandler.lockTaskandDistributedCollectionConfigSetCommandRunner.Tests
OverseerCollectionConfigSetProcessorTest.testLockTaskResolvesFollowedAliasand the newAliasCollectionApiLockTest(Overseer disabled) fail on main and pass with the fix. The lock, alias, DeleteReplica and collection API suites pass.@HoustonPutman @dsmiley could you take a look when you get a chance?