Repository navigation
SOLR-18562: Don't overwrite other aliases when fixing a time routed alias's start - #5191
Open
SpookyJumpyBeans wants to merge 2 commits into
Open
SpookyJumpyBeans wants to merge 2 commits into
SpookyJumpyBeans wants to merge 2 commits into
Conversation
…lias's start When the first document arrives for a time routed alias with date math in router.start, the fixed start is written to aliases.json asynchronously. The modification function ignored the current aliases it was given and returned a clone of an earlier snapshot, so if aliases.json changed in between, the retry wrote the old snapshot over it and any alias created since was lost. Apply the change to the current aliases and set only router.start.
SpookyJumpyBeans
added a commit
to SpookyJumpyBeans/boyidai
that referenced
this pull request
Oct 22, 2026
If the alias is deleted before the asynchronous write runs, return the aliases unchanged instead of throwing from the background task.
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-18562
Description
When the first document arrives for a time routed alias with date math in
router.start,TimeRoutedAlias.validateRouteValue()fixes the start and writes it toaliases.jsonasynchronously. The modification function passed toapplyModificationAndExportToZk()ignores its argument and returns a clone of the aliases snapshot taken earlier. Ifaliases.jsonchanged in between, the CAS fails, the retry reads the current version, and the function returns the old snapshot again, which then gets written. Any alias created after the snapshot is lost.Solution
Build the change on the aliases passed to the function (like every other caller of
applyModificationAndExportToZk), and set onlyrouter.start:Notes:
router.startavoids that.Tests
Added
CreateRoutedAliasTest.testFixingStartKeepsOtherAliases: it creates a time routed alias withstart=NOW/DAY, creates a second alias, puts the hosting node's cached aliases back to before the second alias existed (with reflection, under@SuppressForbidden, since there is no hook to delay a watch event), and sends the first document to that node. It then checks thatrouter.startwas fixed and the second alias still exists.The test fails on main (the second alias is gone:
expected:<...> but was:<null>) and passes with the fix (also 5 more runs with different seeds).CreateRoutedAliasTestandAliasIntegrationTestpass, and so does./gradlew :solr:core:check -x test. I didn't put it inTimeRoutedAliasUpdateProcessorTestbecause that class is@AwaitsFix(SOLR-13059), and so is itstestDateMathInStart(SOLR-13943).Checklist
mainbranch../gradlew check.