HBASE-14472 TestHCM and TestRegionServerNoMaster fixes
This commit is contained in:
parent
5d9ffffc07
commit
5aab961a72
|
@ -336,7 +336,7 @@ public class TestHCM {
|
||||||
// We want to work on a separate connection.
|
// We want to work on a separate connection.
|
||||||
c2.set(HConstants.HBASE_CLIENT_INSTANCE_ID, String.valueOf(-1));
|
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_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.setInt(RpcClient.FAILED_SERVER_EXPIRY_KEY, 0); // Server do not really expire
|
||||||
c2.setBoolean(RpcClient.SPECIFIC_WRITE_THREAD, allowsInterrupt);
|
c2.setBoolean(RpcClient.SPECIFIC_WRITE_THREAD, allowsInterrupt);
|
||||||
|
|
||||||
|
|
|
@ -92,12 +92,12 @@ public class TestRegionServerNoMaster {
|
||||||
throws IOException, InterruptedException {
|
throws IOException, InterruptedException {
|
||||||
// Stop master
|
// Stop master
|
||||||
HMaster master = HTU.getHBaseCluster().getMaster();
|
HMaster master = HTU.getHBaseCluster().getMaster();
|
||||||
|
Thread masterThread = HTU.getHBaseCluster().getMasterThread();
|
||||||
ServerName masterAddr = master.getServerName();
|
ServerName masterAddr = master.getServerName();
|
||||||
master.stopMaster();
|
master.stopMaster();
|
||||||
|
|
||||||
Log.info("Waiting until master thread exits");
|
Log.info("Waiting until master thread exits");
|
||||||
while (HTU.getHBaseCluster().getMasterThread() != null
|
while (masterThread != null && masterThread.isAlive()) {
|
||||||
&& HTU.getHBaseCluster().getMasterThread().isAlive()) {
|
|
||||||
Threads.sleep(100);
|
Threads.sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.regionserver;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
@ -233,8 +234,8 @@ public class TestWALLockup {
|
||||||
try {
|
try {
|
||||||
region.flush(false);
|
region.flush(false);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
LOG.info("In flush", e);
|
||||||
e.printStackTrace();
|
fail();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -246,13 +247,21 @@ public class TestWALLockup {
|
||||||
assertTrue(originalWAL != dodgyWAL.getCurrentFileName());
|
assertTrue(originalWAL != dodgyWAL.getCurrentFileName());
|
||||||
// Can I append to it?
|
// Can I append to it?
|
||||||
dodgyWAL.throwException = false;
|
dodgyWAL.throwException = false;
|
||||||
|
try {
|
||||||
region.put(put);
|
region.put(put);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.info("In the put", e);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// To stop logRoller, its server has to say it is stopped.
|
// To stop logRoller, its server has to say it is stopped.
|
||||||
Mockito.when(server.isStopped()).thenReturn(true);
|
Mockito.when(server.isStopped()).thenReturn(true);
|
||||||
if (logRoller != null) logRoller.interrupt();
|
if (logRoller != null) logRoller.interrupt();
|
||||||
|
try {
|
||||||
if (region != null) region.close();
|
if (region != null) region.close();
|
||||||
if (dodgyWAL != null) dodgyWAL.close();
|
if (dodgyWAL != null) dodgyWAL.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.info("On way out", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue