HBASE-14472 TestHCM and TestRegionServerNoMaster fixes

This commit is contained in:
stack 2015-09-23 10:13:48 -07:00
parent 5d9ffffc07
commit 5aab961a72
3 changed files with 18 additions and 9 deletions

View File

@ -336,7 +336,7 @@ public class TestHCM {
// We want to work on a separate connection.
c2.set(HConstants.HBASE_CLIENT_INSTANCE_ID, String.valueOf(-1));
c2.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 100); // retry a lot
c2.setInt(HConstants.HBASE_CLIENT_PAUSE, 0); // don't wait between retries.
c2.setInt(HConstants.HBASE_CLIENT_PAUSE, 1); // don't wait between retries.
c2.setInt(RpcClient.FAILED_SERVER_EXPIRY_KEY, 0); // Server do not really expire
c2.setBoolean(RpcClient.SPECIFIC_WRITE_THREAD, allowsInterrupt);

View File

@ -92,12 +92,12 @@ public class TestRegionServerNoMaster {
throws IOException, InterruptedException {
// Stop master
HMaster master = HTU.getHBaseCluster().getMaster();
Thread masterThread = HTU.getHBaseCluster().getMasterThread();
ServerName masterAddr = master.getServerName();
master.stopMaster();
Log.info("Waiting until master thread exits");
while (HTU.getHBaseCluster().getMasterThread() != null
&& HTU.getHBaseCluster().getMasterThread().isAlive()) {
while (masterThread != null && masterThread.isAlive()) {
Threads.sleep(100);
}

View File

@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.regionserver;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
@ -233,8 +234,8 @@ public class TestWALLockup {
try {
region.flush(false);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
LOG.info("In flush", e);
fail();
}
};
};
@ -246,13 +247,21 @@ public class TestWALLockup {
assertTrue(originalWAL != dodgyWAL.getCurrentFileName());
// Can I append to it?
dodgyWAL.throwException = false;
region.put(put);
try {
region.put(put);
} catch (Exception e) {
LOG.info("In the put", e);
}
} finally {
// To stop logRoller, its server has to say it is stopped.
Mockito.when(server.isStopped()).thenReturn(true);
if (logRoller != null) logRoller.interrupt();
if (region != null) region.close();
if (dodgyWAL != null) dodgyWAL.close();
try {
if (region != null) region.close();
if (dodgyWAL != null) dodgyWAL.close();
} catch (Exception e) {
LOG.info("On way out", e);
}
}
}
@ -265,4 +274,4 @@ public class TestWALLockup {
return TEST_UTIL.createLocalHRegion(tableName, startKey, stopKey, false, Durability.SYNC_WAL,
wal, COLUMN_FAMILY_BYTES);
}
}
}