HBASE-3214 TestMasterFailover.testMasterFailoverWithMockedRITOnDeadRS is failing (Gary via jgray)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1033617 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Gray 2010-11-10 17:54:48 +00:00
parent 2f6385c6c1
commit 6a5a512773
3 changed files with 37 additions and 26 deletions

View File

@ -671,6 +671,8 @@ Release 0.90.0 - Unreleased
corrupted data
HBASE-3213 If do abort of backup master will get NPE instead of graceful
abort
HBASE-3214 TestMasterFailover.testMasterFailoverWithMockedRITOnDeadRS is
failing (Gary via jgray)
IMPROVEMENTS

View File

@ -144,7 +144,7 @@ public class LocalHBaseCluster {
(Class<? extends HMaster>)conf.getClass(HConstants.MASTER_IMPL,
masterClass);
for (int i = 0; i < noMasters; i++) {
addMaster(i);
addMaster(new Configuration(conf), i);
}
// Start the HRegionServers.
this.regionServerClass =
@ -152,60 +152,62 @@ public class LocalHBaseCluster {
regionServerClass);
for (int i = 0; i < noRegionServers; i++) {
addRegionServer(i);
addRegionServer(new Configuration(conf), i);
}
}
public JVMClusterUtil.RegionServerThread addRegionServer() throws IOException {
return addRegionServer(this.regionThreads.size());
public JVMClusterUtil.RegionServerThread addRegionServer()
throws IOException {
return addRegionServer(new Configuration(conf), this.regionThreads.size());
}
public JVMClusterUtil.RegionServerThread addRegionServer(final int index)
public JVMClusterUtil.RegionServerThread addRegionServer(
Configuration config, final int index)
throws IOException {
// Create each regionserver with its own Configuration instance so each has
// its HConnection instance rather than share (see HBASE_INSTANCES down in
// the guts of HConnectionManager.
JVMClusterUtil.RegionServerThread rst =
JVMClusterUtil.createRegionServerThread(new Configuration(this.conf),
JVMClusterUtil.createRegionServerThread(config,
this.regionServerClass, index);
this.regionThreads.add(rst);
return rst;
}
public JVMClusterUtil.RegionServerThread addRegionServer(
final int index, User user)
final Configuration config, final int index, User user)
throws IOException, InterruptedException {
return user.runAs(
new PrivilegedExceptionAction<JVMClusterUtil.RegionServerThread>() {
public JVMClusterUtil.RegionServerThread run() throws Exception {
return addRegionServer(index);
return addRegionServer(config, index);
}
});
}
public JVMClusterUtil.MasterThread addMaster() throws IOException {
return addMaster(this.masterThreads.size());
return addMaster(new Configuration(conf), this.masterThreads.size());
}
public JVMClusterUtil.MasterThread addMaster(final int index)
public JVMClusterUtil.MasterThread addMaster(Configuration c, final int index)
throws IOException {
// Create each master with its own Configuration instance so each has
// its HConnection instance rather than share (see HBASE_INSTANCES down in
// the guts of HConnectionManager.
JVMClusterUtil.MasterThread mt =
JVMClusterUtil.createMasterThread(new Configuration(this.conf),
JVMClusterUtil.createMasterThread(c,
this.masterClass, index);
this.masterThreads.add(mt);
return mt;
}
public JVMClusterUtil.MasterThread addMaster(
final int index, User user)
final Configuration c, final int index, User user)
throws IOException, InterruptedException {
return user.runAs(
new PrivilegedExceptionAction<JVMClusterUtil.MasterThread>() {
public JVMClusterUtil.MasterThread run() throws Exception {
return addMaster(index);
return addMaster(c, index);
}
});
}

View File

@ -265,9 +265,10 @@ public class MiniHBaseCluster {
// manually add the regionservers as other users
for (int i=0; i<nRegionNodes; i++) {
User user = HBaseTestingUtility.getDifferentUser(conf,
Configuration rsConf = HBaseConfiguration.create(conf);
User user = HBaseTestingUtility.getDifferentUser(rsConf,
".hfs."+index++);
hbaseCluster.addRegionServer(i, user);
hbaseCluster.addRegionServer(rsConf, i, user);
}
hbaseCluster.startup();
@ -289,16 +290,13 @@ public class MiniHBaseCluster {
*/
public JVMClusterUtil.RegionServerThread startRegionServer()
throws IOException {
final Configuration newConf = HBaseConfiguration.create(conf);
User rsUser =
HBaseTestingUtility.getDifferentUser(conf, ".hfs."+index++);
HBaseTestingUtility.getDifferentUser(newConf, ".hfs."+index++);
JVMClusterUtil.RegionServerThread t = null;
try {
t = rsUser.runAs(
new PrivilegedExceptionAction<JVMClusterUtil.RegionServerThread>() {
public JVMClusterUtil.RegionServerThread run() throws Exception {
return hbaseCluster.addRegionServer();
}
});
t = hbaseCluster.addRegionServer(
newConf, hbaseCluster.getRegionServers().size(), rsUser);
t.start();
t.waitForServerOnline();
} catch (InterruptedException ie) {
@ -365,9 +363,18 @@ public class MiniHBaseCluster {
* @return New RegionServerThread
*/
public JVMClusterUtil.MasterThread startMaster() throws IOException {
JVMClusterUtil.MasterThread t = this.hbaseCluster.addMaster();
Configuration c = HBaseConfiguration.create(conf);
User user =
HBaseTestingUtility.getDifferentUser(c, ".hfs."+index++);
JVMClusterUtil.MasterThread t = null;
try {
t = hbaseCluster.addMaster(c, hbaseCluster.getMasters().size(), user);
t.start();
t.waitForServerOnline();
} catch (InterruptedException ie) {
throw new IOException("Interrupted executing UserGroupInformation.doAs()", ie);
}
return t;
}