HBASE-26858 Refactor TestMasterRegionOnTwoFileSystems to avoid dead loop (#4238)
Signed-off-by: Xiaolin Ha <haxiaolin@apache.org>
(cherry picked from commit 31db8e3b3b
)
This commit is contained in:
parent
2e8f0a0326
commit
6be8c33789
|
@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.master.region;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
@ -185,7 +186,7 @@ public class TestMasterRegionOnTwoFileSystems {
|
||||||
LOG.info("wal archive dir {}", walArchiveDir);
|
LOG.info("wal archive dir {}", walArchiveDir);
|
||||||
AbstractFSWAL<?> wal = (AbstractFSWAL<?>) region.region.getWAL();
|
AbstractFSWAL<?> wal = (AbstractFSWAL<?>) region.region.getWAL();
|
||||||
Path currentWALFile = wal.getCurrentFileName();
|
Path currentWALFile = wal.getCurrentFileName();
|
||||||
for (;;) {
|
for (int i = 0; ; i++) {
|
||||||
region.requestRollAll();
|
region.requestRollAll();
|
||||||
region.waitUntilWalRollFinished();
|
region.waitUntilWalRollFinished();
|
||||||
Path newWALFile = wal.getCurrentFileName();
|
Path newWALFile = wal.getCurrentFileName();
|
||||||
|
@ -193,6 +194,10 @@ public class TestMasterRegionOnTwoFileSystems {
|
||||||
if (!newWALFile.equals(currentWALFile)) {
|
if (!newWALFile.equals(currentWALFile)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (i == 10) {
|
||||||
|
fail("Can not roll wal after " + i + " times");
|
||||||
|
}
|
||||||
|
Thread.sleep(1000);
|
||||||
}
|
}
|
||||||
HFILE_UTIL.waitFor(15000, () -> {
|
HFILE_UTIL.waitFor(15000, () -> {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue