ctubbsii commented on a change in pull request #1556: WIP - Fixes #1488 - 
ManyWriteAheadLogsIT asserts open WALS equal to zero.
URL: https://github.com/apache/accumulo/pull/1556#discussion_r390654546
 
 

 ##########
 File path: 
test/src/main/java/org/apache/accumulo/test/functional/ManyWriteAheadLogsIT.java
 ##########
 @@ -198,16 +198,33 @@ public void testMany() throws Exception {
   }
 
   private void addOpenWals(ServerContext c, Set<String> allWalsSeen) throws 
Exception {
-    Map<String,WalState> wals = WALSunnyDayIT._getWals(c);
-    Set<Entry<String,WalState>> es = wals.entrySet();
+
     int open = 0;
-    for (Entry<String,WalState> entry : es) {
-      if (entry.getValue() == WalState.OPEN) {
-        open++;
-        allWalsSeen.add(entry.getKey());
+    int attempts = 0;
+    boolean foundWal = false;
+
+    while (open == 0) {
+      attempts++;
+      Map<String,WalState> wals = WALSunnyDayIT._getWals(c);
+      Set<Entry<String,WalState>> es = wals.entrySet();
+      for (Entry<String,WalState> entry : es) {
+        if (entry.getValue() == WalState.OPEN) {
+          open++;
+          allWalsSeen.add(entry.getKey());
+          foundWal = true;
+        } else {
+          log.error("The WalState is " + entry.getValue());// CLOSED or 
UNREFERENCED
+        }
+      }
+
+      if (!foundWal) {
+        Thread.sleep(50);
+        if (attempts % 50 == 0)
+          log.info("Has not found an open WAL in " + attempts + " attempts.");
       }
     }
 
+    log.debug("It took " + attempts + " attempt(s) to find an open WAL");
 
 Review comment:
   ```suggestion
       log.debug("It took {} attempt(s) to find {} open WALs", attempts, open);
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to