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

    https://github.com/apache/lucene-solr/pull/433#discussion_r214173448
  
    --- Diff: 
solr/core/src/java/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessor.java
 ---
    @@ -437,45 +461,46 @@ protected void doClose() {
     
     
       /**
    -   * Create as many collections as required. This method loops to allow 
for the possibility that the routeTimestamp
    +   * Create as many collections as required. This method loops to allow 
for the possibility that the docTimestamp
        * requires more than one collection to be created. Since multiple 
threads may be invoking maintain on separate
        * requests to the same alias, we must pass in the name of the 
collection that this thread believes to be the most
        * recent collection. This assumption is checked when the command is 
executed in the overseer. When this method
        * finds that all collections required have been created it returns the 
(possibly new) most recent collection.
        * The return value is ignored by the calling code in the async 
preemptive case.
        *
    -   * @param targetCollection the initial notion of the latest collection 
available.
        * @param docTimestamp the timestamp from the document that determines 
routing
        * @param printableId an identifier for the add command used in error 
messages
    +   * @param targetCollectionDesc the descriptor for the presently selected 
collection which should also be
    +   *                             the most recent collection in all cases 
where this method is invoked.
        * @return The latest collection, including collections created during 
maintenance
        */
    -  public String maintain(String targetCollection, Instant docTimestamp, 
String printableId, boolean asyncSinglePassOnly) {
    -    do { // typically we don't loop; it's only when we need to create a 
collection
    -
    -      // Note: This code no longer short circuits immediately when it sees 
that the expected latest
    -      // collection is the current latest collection. With the advent of 
preemptive collection creation
    -      // we always need to do the time based checks. Otherwise, we cannot 
handle the case where the
    -      // preemptive window is larger than our TRA's time slices
    -
    -      // Check the doc isn't too far in the future
    -
    -      if (NONE == requiresCreateCollection(docTimestamp, 
timeRoutedAlias.getPreemptiveCreateWindow()))
    -        return targetCollection; // thus we don't need another collection
    +  private String createAllRequiredCollections( Instant docTimestamp, 
String printableId,
    +                                               Map.Entry<Instant, String> 
targetCollectionDesc) {
    +    do {
    +      switch(typeOfCreationRequired(docTimestamp, 
targetCollectionDesc.getKey())) {
    +        case NONE:
    +          return targetCollectionDesc.getValue(); // we don't need another 
collection
    +        case ASYNC_PREEMPTIVE:
    +          // can happen when preemptive interval is longer than one time 
slice
    +          preemptiveAsync(() -> 
createNextCollection(this.parsedCollectionsDesc.get(0).getValue()));
    --- End diff --
    
    Agree see above comment


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to