Skip to content

Commit

Permalink
HBASE-14843 TestWALProcedureStore.testLoad is flakey (addendum)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo Bertozzi committed Nov 24, 2015
1 parent afc5439 commit 0bae444
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Expand Up @@ -111,13 +111,14 @@ public interface LeaseRecovery {
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 final AtomicReference<Throwable> syncException = new AtomicReference<Throwable>();
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<ByteSlot> slotsCache = null;
private Set<ProcedureWALFile> 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;
Expand Down Expand Up @@ -148,6 +149,7 @@ public void start(int numSlots) throws IOException {
}

// Init buffer slots
loading.set(true);
slots = new ByteSlot[numSlots];
slotsCache = new LinkedTransferQueue();
while (slotsCache.size() < numSlots) {
Expand Down
Expand Up @@ -83,6 +83,7 @@ public void setUp() throws IOException {
procStore = ProcedureTestingUtility.createWalStore(htu.getConfiguration(), fs, logDir);
procStore.start(PROCEDURE_STORE_SLOTS);
procStore.recoverLease();
procStore.load(new LoadCounter());
}

@After
Expand Down Expand Up @@ -434,7 +435,9 @@ private void corruptLog(final FileStatus logFile, final long dropBytes)
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<Long> procIds) throws Exception {
Expand Down

0 comments on commit 0bae444

Please sign in to comment.