From da48ddb7ba45260e3864566b2ebbe65e0a0186ec Mon Sep 17 00:00:00 2001 From: Matteo Bertozzi Date: Mon, 23 Nov 2015 23:35:10 -0800 Subject: [PATCH] HBASE-14843 TestWALProcedureStore.testLoad is flakey (addendum) --- .../procedure2/store/wal/WALProcedureStore.java | 12 +++++++----- .../procedure2/store/wal/TestWALProcedureStore.java | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) 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 0d2427a55e6..ec42d6a156c 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,13 +111,14 @@ 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 syncException = new AtomicReference<>(); + private final AtomicReference syncException = new AtomicReference(); + private final AtomicBoolean loading = new AtomicBoolean(true); + private final AtomicBoolean inSync = new AtomicBoolean(false); + private final AtomicLong totalSynced = new AtomicLong(0); + private final AtomicLong lastRollTs = new AtomicLong(0); + private LinkedTransferQueue slotsCache = null; private Set corruptedLogs = null; - private AtomicLong totalSynced = new AtomicLong(0); - private AtomicLong lastRollTs = new AtomicLong(0); private FSDataOutputStream stream = null; private long flushLogId = 0; private int slotIndex = 0; @@ -148,6 +149,7 @@ public class WALProcedureStore extends ProcedureStoreBase { } // Init buffer slots + loading.set(true); slots = new ByteSlot[numSlots]; slotsCache = new LinkedTransferQueue(); while (slotsCache.size() < numSlots) { 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 5a96da4ff44..1265f3fab3e 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 @@ -84,6 +84,7 @@ public class TestWALProcedureStore { procStore = ProcedureTestingUtility.createWalStore(htu.getConfiguration(), fs, logDir); procStore.start(PROCEDURE_STORE_SLOTS); procStore.recoverLease(); + procStore.load(new LoadCounter()); } @After @@ -435,7 +436,9 @@ public class TestWALProcedureStore { InputStream in = fs.open(logFile.getPath()); OutputStream out = fs.create(tmpPath); IOUtils.copyBytes(in, out, logFile.getLen() - dropBytes, true); - fs.rename(tmpPath, logFile.getPath()); + if (!fs.rename(tmpPath, logFile.getPath())) { + throw new IOException("Unable to rename"); + } } private void verifyProcIdsOnRestart(final Set procIds) throws Exception {