HBASE-14608 testWalRollOnLowReplication has some risk to assert failed after HBASE-14600 (Heng Chen)

This commit is contained in:
stack 2015-10-14 23:02:17 -07:00
parent bd78320caa
commit a3f588b26f
1 changed files with 21 additions and 11 deletions

View File

@ -71,6 +71,17 @@ public class TestWALProcedureStoreOnHDFS {
private WALProcedureStore store;
private ProcedureStore.ProcedureStoreListener stopProcedureListener = new ProcedureStore.ProcedureStoreListener() {
@Override
public void postSync() {}
@Override
public void abortProcess() {
LOG.fatal("Abort the Procedure Store");
store.stop(true);
}
};
private static void setupConf(Configuration conf) {
conf.setInt("dfs.replication", 3);
conf.setInt("dfs.namenode.replication.min", 3);
@ -89,16 +100,7 @@ public class TestWALProcedureStoreOnHDFS {
Path logDir = new Path(new Path(dfs.getFileSystem().getUri()), "/test-logs");
store = ProcedureTestingUtility.createWalStore(
UTIL.getConfiguration(), dfs.getFileSystem(), logDir);
store.registerListener(new ProcedureStore.ProcedureStoreListener() {
@Override
public void postSync() {}
@Override
public void abortProcess() {
LOG.fatal("Abort the Procedure Store");
store.stop(true);
}
});
store.registerListener(stopProcedureListener);
store.start(8);
store.recoverLease();
}
@ -136,7 +138,6 @@ public class TestWALProcedureStoreOnHDFS {
@Test(timeout=60000)
public void testWalAbortOnLowReplicationWithQueuedWriters() throws Exception {
assertEquals(3, UTIL.getDFSCluster().getDataNodes().size());
store.registerListener(new ProcedureStore.ProcedureStoreListener() {
@Override
public void postSync() {
@ -182,6 +183,15 @@ public class TestWALProcedureStoreOnHDFS {
@Test(timeout=60000)
public void testWalRollOnLowReplication() throws Exception {
store.unregisterListener(stopProcedureListener);
store.registerListener(new ProcedureStore.ProcedureStoreListener() {
@Override
public void postSync() {}
@Override
public void abortProcess() {
}
});
int dnCount = 0;
store.insert(new TestProcedure(1, -1), null);
UTIL.getDFSCluster().restartDataNode(dnCount);