HBASE-4749 TestMasterFailover#testMasterFailoverWithMockedRITOnDeadRS occasionally fails

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1198007 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-11-05 18:45:24 +00:00
parent 2ee75203ed
commit 7052e59b38
3 changed files with 17 additions and 5 deletions

View File

@ -451,6 +451,8 @@ Release 0.92.0 - Unreleased
HBASE-4553 The update of .tableinfo is not atomic; we remove then rename
HBASE-4725 NPE in AM#updateTimers
HBASE-4745 LRU statistics thread should be a daemon
HBASE-4749 TestMasterFailover#testMasterFailoverWithMockedRITOnDeadRS
occasionally fails
TESTS
HBASE-4450 test for number of blocks read: to serve as baseline for expected

View File

@ -1319,8 +1319,10 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
LOG.info(why);
this.stopped = true;
// If we are a backup master, we need to interrupt wait
synchronized (this.activeMasterManager.clusterHasActiveMaster) {
this.activeMasterManager.clusterHasActiveMaster.notifyAll();
if (this.activeMasterManager != null) {
synchronized (this.activeMasterManager.clusterHasActiveMaster) {
this.activeMasterManager.clusterHasActiveMaster.notifyAll();
}
}
}

View File

@ -50,6 +50,7 @@ import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.FSTableDescriptors;
import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.apache.hadoop.hbase.util.Threads;
import org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread;
import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;
import org.apache.hadoop.hbase.zookeeper.ZKAssign;
@ -706,10 +707,13 @@ public class TestMasterFailover {
assertEquals(2, cluster.countServedRegions());
// The first RS will stay online
HRegionServer hrs = cluster.getRegionServer(0);
List<RegionServerThread> regionservers =
cluster.getRegionServerThreads();
HRegionServer hrs = regionservers.get(0).getRegionServer();
// The second RS is going to be hard-killed
HRegionServer hrsDead = cluster.getRegionServer(1);
RegionServerThread hrsDeadThread = regionservers.get(1);
HRegionServer hrsDead = hrsDeadThread.getRegionServer();
ServerName deadServerName = hrsDead.getServerName();
// we'll need some regions to already be assigned out properly on live RS
@ -916,7 +920,11 @@ public class TestMasterFailover {
hrsDead.abort("Killing for unit test");
log("RS " + deadServerName + " killed");
// Start up a new master
// Start up a new master. Wait until regionserver is completely down
// before starting new master because of hbase-4511.
while (hrsDeadThread.isAlive()) {
Threads.sleep(10);
}
log("Starting up a new master");
master = cluster.startMaster().getMaster();
log("Waiting for master to be ready");