This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new b681459  Fix #1488 ManyWriteAheadLogsIT wait for non-zero WALs (#1556)
b681459 is described below

commit b681459fe6d720cc847bd22917265e866c64ccf4
Author: Jeffrey Zeiberg <jzeib...@gmail.com>
AuthorDate: Fri Mar 13 16:51:18 2020 -0400

    Fix #1488 ManyWriteAheadLogsIT wait for non-zero WALs (#1556)
    
    * Add debugging to report seen CLOSED and UNREFERENCED WALs (not OPEN)
    * Wait for open WALs to be non-zero by retrying in a loop until the test 
times out
    
    Co-Authored-By: Christopher Tubbs <ctubb...@apache.org>
---
 .../test/functional/ManyWriteAheadLogsIT.java      | 29 +++++++++++++++++-----
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git 
a/test/src/main/java/org/apache/accumulo/test/functional/ManyWriteAheadLogsIT.java
 
b/test/src/main/java/org/apache/accumulo/test/functional/ManyWriteAheadLogsIT.java
index cd86ef8..843a0ca 100644
--- 
a/test/src/main/java/org/apache/accumulo/test/functional/ManyWriteAheadLogsIT.java
+++ 
b/test/src/main/java/org/apache/accumulo/test/functional/ManyWriteAheadLogsIT.java
@@ -198,16 +198,33 @@ public class ManyWriteAheadLogsIT extends 
AccumuloClusterHarness {
   }
 
   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.debug("The WalState for {} is {}", entry.getKey(), 
entry.getValue()); // CLOSED or UNREFERENCED
+        }
+      }
+
+      if (!foundWal) {
+        Thread.sleep(50);
+        if (attempts % 50 == 0)
+          log.debug("No open WALs found in {} attempts.", attempts);
       }
     }
 
+    log.debug("It took {} attempt(s) to find {} open WALs", attempts, open);
     assertTrue("Open WALs not in expected range " + open, open > 0 && open < 
4);
   }
 

Reply via email to