Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/422#discussion_r204529806
  
    --- Diff: 
solr/core/src/java/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessor.java
 ---
    @@ -405,4 +454,56 @@ protected void doClose() {
             collection, slice.getName());
       }
     
    +  private class Maintainer  {
    +    private final Instant routeTimestamp;
    +    private final String id;
    +
    +    public Maintainer(Instant routeTimestamp, String id) {
    +      this.routeTimestamp = routeTimestamp;
    +      this.id = id;
    +    }
    +
    +    public String maintain(String targetCollection) {
    +      do { // typically we don't loop; it's only when we need to create a 
collection
    +
    +        // Note: the following rule is tempting but not necessary and is 
not compatible with
    +        // only using this URP when the alias distrib phase is NONE; 
otherwise a doc may be routed to from a non-recent
    +        // collection to the most recent only to then go there directly 
instead of realizing a new collection is needed.
    +        //      // If it's going to some other collection (not "this") 
then break to just send it there
    +        //      if (!thisCollection.equals(targetCollection)) {
    +        //        break;
    +        //      }
    +        // Also tempting but not compatible:  check that we're the leader, 
if not then break
    +
    +        // If the doc goes to the most recent collection then do some 
checks below, otherwise break the loop.
    +
    +        final String mostRecentCollName = 
parsedCollectionsDesc.get(0).getValue();
    +        if (!mostRecentCollName.equals(targetCollection)) {
    +          return targetCollection;
    +        }
    +
    +        // Check the doc isn't too far in the future
    +        final Instant maxFutureTime = 
Instant.now().plusMillis(timeRoutedAlias.getMaxFutureMs());
    --- End diff --
    
    I think this check is only pertinent for synchronous creation?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to