[
https://issues.apache.org/jira/browse/SOLR-18562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated SOLR-18562:
----------------------------------
Labels: pull-request-available (was: )
> Fixing a time routed alias's date math start can remove another alias from
> aliases.json
> ---------------------------------------------------------------------------------------
>
> Key: SOLR-18562
> URL: https://issues.apache.org/jira/browse/SOLR-18562
> Project: Solr
> Issue Type: Bug
> Components: SolrCloud
> Reporter: Boyi Dai
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When a time routed alias is created with date math in router.start (e.g.
> NOW/DAY), the first document routed through it fixes the start to an instant
> (SOLR-13760). TimeRoutedAlias.validateRouteValue() takes a snapshot of the
> node's cached aliases, adds the new router.start to the alias's properties,
> and then writes it asynchronously with
> AliasesManager.applyModificationAndExportToZk().
> The modification function ignores the current aliases it is passed and
> returns the snapshot instead:
> {code:java}
> Aliases aliases = zkStateReader.getAliases();
> ...
> core.runAsync(
> () ->
> zkStateReader.aliasesManager.applyModificationAndExportToZk(
> (a) -> aliases.cloneWithCollectionAliasProperties(aliasName,
> props)));
> {code}
> applyModificationAndExportToZk() writes with the znode version of the current
> aliases and, on a BadVersionException, refreshes and calls the function
> again. Since the function always returns the old snapshot, the retry writes
> the old collection aliases over the new version. Any alias created (or alias
> property changed) after the snapshot was taken is silently removed from
> aliases.json. Every other caller of applyModificationAndExportToZk builds on
> its argument.
> This was found through code analysis.
> *Steps to reproduce:*
> # Create a time routed alias A with router.start=NOW/DAY.
> # Create another alias B before the node that will receive A's first document
> has seen it (or before the asynchronous write runs).
> # Send the first document for A to that node.
> # Result: router.start is fixed, but B is gone from aliases.json. Requests to
> B fail, and refreshing doesn't bring it back since the alias is lost in
> ZooKeeper.
> *Expected:* only A's router.start changes; other aliases are untouched.
> *Proposed fix:* apply the change to the aliases passed to the modification
> function, and only set router.start instead of copying all of A's properties
> from the snapshot. I have a patch with a test and will open a PR.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]