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

    https://github.com/apache/lucene-solr/pull/433#discussion_r208719459
  
    --- Diff: 
solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java
 ---
    @@ -343,8 +444,31 @@ public void testSliceRouting() throws Exception {
       }
     
       private void waitCol(final String datePart, int slices) {
    -    waitForState("waiting for collections to be created",alias + "_" + 
datePart,
    -        (liveNodes, collectionState) -> 
collectionState.getActiveSlices().size() == slices);
    +    // collection to exist
    +    String collection = alias + "_" + datePart;
    +    waitForState("waiting for collections to be created", collection,
    +        (liveNodes, collectionState) -> {
    +          if (collectionState == null) {
    +            // per predicate javadoc, this is what we get if the 
collection doesn't exist at all.
    +            return false;
    +          }
    +          Collection<Slice> activeSlices = 
collectionState.getActiveSlices();
    +          int size = activeSlices.size();
    +          return size == slices;
    +        });
    +    // and alias to be aware of collection
    +    long start = System.nanoTime(); // mumble mumble precommit mumble 
mumble...
    +    while 
(!cluster.getSolrClient().getZkStateReader().getAliases().getCollectionAliasListMap().get(alias).contains(collection))
 {
    +      if (NANOSECONDS.toSeconds(System.nanoTime() - start) > 10) {
    +        fail("took over 10 seconds after collection creation to update 
aliases");
    +      } else {
    +        try {
    +          Thread.sleep(500);
    +        } catch (InterruptedException e) {
    +          e.printStackTrace();
    --- End diff --
    
    -- and return or throw.  Interrupt means stop what you're doing.


---

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

Reply via email to