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

    https://github.com/apache/accumulo/pull/128#discussion_r71263937
  
    --- Diff: 
test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java ---
    @@ -232,4 +216,53 @@ private void writeSomeData(Connector conn, String 
tableName, int row, int col) t
         return result;
       }
     
    +  private final int TIMES_TO_COUNT = 20;
    +  private final int PAUSE_BETWEEN_COUNTS = 100;
    +
    +  private Map<String,Boolean> getWALsAndAssertCount(Connector c, int 
expectedCount) throws Exception {
    +    // see https://issues.apache.org/jira/browse/ACCUMULO-4110. Sometimes 
this test counts the logs before
    +    // the new standby log is actually ready. So let's try a few times 
before failing, returning the last
    +    // wals variable with the the correct count.
    +    Map<String,Boolean> wals = _getWals(c);
    +    if (wals.size() == expectedCount) {
    +      return wals;
    +    }
    +
    +    int waitLonger = getWaitFactor();
    +    for (int i = 1; i <= TIMES_TO_COUNT; i++) {
    +      Thread.sleep(i * PAUSE_BETWEEN_COUNTS * waitLonger);
    +      wals = _getWals(c);
    +      if (wals.size() == expectedCount) {
    +        return wals;
    +      }
    +    }
    +
    +    fail("Unable to get the correct number of WALs, expected " + 
expectedCount + " but got " + wals.toString());
    --- End diff --
    
    If I make that change, doesn't it change the assertions of the original 
test?  I started with what you suggest, without the for loop to retry, just to 
ensure I got the same behavior.  A run that previously failed on line 113 
saying "should have 3 WALs after roll", started failing on line 115 saying "all 
WALs should be in use".    It didn't make sense to me, so I added back a fail 
statement if the correct count could not be collected.  Let's talk though this 
more tomorrow.  Thanks Josh


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to