HBASE-11217 Race between SplitLogManager task creation + TimeoutMonitor - ADDENDUM to fix unit test
This commit is contained in:
parent
ea0731d60f
commit
9dcebc396b
|
@ -491,51 +491,6 @@ public class TestSplitLogManager {
|
||||||
assertFalse(fs.exists(emptyLogDirPath));
|
assertFalse(fs.exists(emptyLogDirPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout=45000)
|
|
||||||
public void testVanishingTaskZNode() throws Exception {
|
|
||||||
LOG.info("testVanishingTaskZNode");
|
|
||||||
|
|
||||||
conf.setInt("hbase.splitlog.manager.unassigned.timeout", 0);
|
|
||||||
conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 1000);
|
|
||||||
slm = new SplitLogManager(zkw, conf, stopper, master, DUMMY_MASTER);
|
|
||||||
FileSystem fs = TEST_UTIL.getTestFileSystem();
|
|
||||||
final Path logDir = new Path(fs.getWorkingDirectory(),
|
|
||||||
UUID.randomUUID().toString());
|
|
||||||
fs.mkdirs(logDir);
|
|
||||||
Thread thread = null;
|
|
||||||
try {
|
|
||||||
Path logFile = new Path(logDir, UUID.randomUUID().toString());
|
|
||||||
fs.createNewFile(logFile);
|
|
||||||
thread = new Thread() {
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
// this call will block because there are no SplitLogWorkers,
|
|
||||||
// until the task znode is deleted below. Then the call will
|
|
||||||
// complete successfully, assuming the log is split.
|
|
||||||
slm.splitLogDistributed(logDir);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOG.warn("splitLogDistributed failed", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
thread.start();
|
|
||||||
waitForCounter(tot_mgr_node_create_result, 0, 1, 10000);
|
|
||||||
String znode = ZKSplitLog.getEncodedNodeName(zkw, logFile.toString());
|
|
||||||
// remove the task znode, to finish the distributed log splitting
|
|
||||||
ZKUtil.deleteNode(zkw, znode);
|
|
||||||
waitForCounter(tot_mgr_get_data_nonode, 0, 1, 30000);
|
|
||||||
waitForCounter(tot_mgr_log_split_batch_success, 0, 1, to/2);
|
|
||||||
assertTrue(fs.exists(logFile));
|
|
||||||
} finally {
|
|
||||||
if (thread != null) {
|
|
||||||
// interrupt the thread in case the test fails in the middle.
|
|
||||||
// it has no effect if the thread is already terminated.
|
|
||||||
thread.interrupt();
|
|
||||||
}
|
|
||||||
fs.delete(logDir, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The following test case is aiming to test the situation when distributedLogReplay is turned off
|
* The following test case is aiming to test the situation when distributedLogReplay is turned off
|
||||||
* and restart a cluster there should no recovery regions in ZK left.
|
* and restart a cluster there should no recovery regions in ZK left.
|
||||||
|
|
Loading…
Reference in New Issue