Skip to content

Commit

Permalink
HBASE-26858 Refactor TestMasterRegionOnTwoFileSystems to avoid dead l…
Browse files Browse the repository at this point in the history
…oop (#4238)

Signed-off-by: Xiaolin Ha <[email protected]>
(cherry picked from commit 31db8e3)
  • Loading branch information
Apache9 committed Mar 18, 2022
1 parent 4a6ba11 commit ac5651c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand Down Expand Up @@ -188,14 +189,18 @@ public void testFlushAndCompact() throws Exception {
LOG.info("wal archive dir {}", walArchiveDir);
AbstractFSWAL<?> wal = (AbstractFSWAL<?>) region.region.getWAL();
Path currentWALFile = wal.getCurrentFileName();
for (;;) {
for (int i = 0; ; i++) {
region.requestRollAll();
region.waitUntilWalRollFinished();
Path newWALFile = wal.getCurrentFileName();
// make sure we actually rolled the wal
if (!newWALFile.equals(currentWALFile)) {
break;
}
if (i == 10) {
fail("Can not roll wal after " + i + " times");
}
Thread.sleep(1000);
}
HFILE_UTIL.waitFor(15000, () -> {
try {
Expand Down

0 comments on commit ac5651c

Please sign in to comment.