hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [3/4] hbase git commit: HBASE-14843 TestWALProcedureStore.testLoad is flakey
Date Mon, 23 Nov 2015 18:55:04 GMT
HBASE-14843 TestWALProcedureStore.testLoad is flakey


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/221ae585
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/221ae585
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/221ae585

Branch: refs/heads/branch-1
Commit: 221ae58555f34bd8a1de8757b15cb7d3301a90ff
Parents: 599589b
Author: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Authored: Mon Nov 23 09:54:42 2015 -0800
Committer: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Committed: Mon Nov 23 09:58:48 2015 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/procedure2/store/wal/WALProcedureStore.java  | 7 ++++++-
 .../hbase/procedure2/store/wal/TestWALProcedureStore.java     | 6 ++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/221ae585/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/wal/WALProcedureStore.java
----------------------------------------------------------------------
diff --git a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/wal/WALProcedureStore.java
b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/wal/WALProcedureStore.java
index f724a3e..0d2427a 100644
--- a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/wal/WALProcedureStore.java
+++ b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/wal/WALProcedureStore.java
@@ -111,6 +111,7 @@ public class WALProcedureStore extends ProcedureStoreBase {
   private final FileSystem fs;
   private final Path logDir;
 
+  private AtomicBoolean loading = new AtomicBoolean(true);
   private AtomicBoolean inSync = new AtomicBoolean(false);
   private AtomicReference<Throwable> syncException = new AtomicReference<>();
   private LinkedTransferQueue<ByteSlot> slotsCache = null;
@@ -276,6 +277,7 @@ public class WALProcedureStore extends ProcedureStoreBase {
         LOG.debug("No state logs to replay.");
       }
       loader.setMaxProcId(0);
+      loading.set(false);
       return;
     }
 
@@ -320,6 +322,7 @@ public class WALProcedureStore extends ProcedureStoreBase {
           removeLogFile(log);
         }
       }
+      loading.set(false);
     }
   }
 
@@ -528,7 +531,9 @@ public class WALProcedureStore extends ProcedureStoreBase {
         try {
           // Wait until new data is available
           if (slotIndex == 0) {
-            removeInactiveLogs();
+            if (!loading.get()) {
+              removeInactiveLogs();
+            }
 
             if (LOG.isTraceEnabled()) {
               float rollTsSec = getMillisFromLastRoll() / 1000.0f;

http://git-wip-us.apache.org/repos/asf/hbase/blob/221ae585/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/wal/TestWALProcedureStore.java
----------------------------------------------------------------------
diff --git a/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/wal/TestWALProcedureStore.java
b/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/wal/TestWALProcedureStore.java
index d98eddd..5a96da4 100644
--- a/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/wal/TestWALProcedureStore.java
+++ b/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/wal/TestWALProcedureStore.java
@@ -384,6 +384,12 @@ public class TestWALProcedureStore {
     procStore.start(NTHREAD);
     procStore.recoverLease();
 
+    LoadCounter loader = new LoadCounter();
+    procStore.load(loader);
+    assertEquals(0, loader.getMaxProcId());
+    assertEquals(0, loader.getLoadedCount());
+    assertEquals(0, loader.getCorruptedCount());
+
     final long LAST_PROC_ID = 9999;
     final Thread[] thread = new Thread[NTHREAD];
     final AtomicLong procCounter = new AtomicLong((long)Math.round(Math.random() * 100));


Mime
View raw message