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 corrupted data
HBASE-3213 If do abort of backup master will get NPE instead of graceful HBASE-3213 If do abort of backup master will get NPE instead of graceful
abort abort
HBASE-3214 TestMasterFailover.testMasterFailoverWithMockedRITOnDeadRS is
failing (Gary via jgray)
IMPROVEMENTS IMPROVEMENTS

View File

@ -144,7 +144,7 @@ public class LocalHBaseCluster {
(Class<? extends HMaster>)conf.getClass(HConstants.MASTER_IMPL, (Class<? extends HMaster>)conf.getClass(HConstants.MASTER_IMPL,
masterClass); masterClass);
for (int i = 0; i < noMasters; i++) { for (int i = 0; i < noMasters; i++) {
addMaster(i); addMaster(new Configuration(conf), i);
} }
// Start the HRegionServers. // Start the HRegionServers.
this.regionServerClass = this.regionServerClass =
@ -152,60 +152,62 @@ public class LocalHBaseCluster {
regionServerClass); regionServerClass);
for (int i = 0; i < noRegionServers; i++) { for (int i = 0; i < noRegionServers; i++) {
addRegionServer(i); addRegionServer(new Configuration(conf), i);
} }
} }
public JVMClusterUtil.RegionServerThread addRegionServer() throws IOException { public JVMClusterUtil.RegionServerThread addRegionServer()
return addRegionServer(this.regionThreads.size()); 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 { throws IOException {
// Create each regionserver with its own Configuration instance so each has // Create each regionserver with its own Configuration instance so each has
// its HConnection instance rather than share (see HBASE_INSTANCES down in // its HConnection instance rather than share (see HBASE_INSTANCES down in
// the guts of HConnectionManager. // the guts of HConnectionManager.
JVMClusterUtil.RegionServerThread rst = JVMClusterUtil.RegionServerThread rst =
JVMClusterUtil.createRegionServerThread(new Configuration(this.conf), JVMClusterUtil.createRegionServerThread(config,
this.regionServerClass, index); this.regionServerClass, index);
this.regionThreads.add(rst); this.regionThreads.add(rst);
return rst; return rst;
} }
public JVMClusterUtil.RegionServerThread addRegionServer( public JVMClusterUtil.RegionServerThread addRegionServer(
final int index, User user) final Configuration config, final int index, User user)
throws IOException, InterruptedException { throws IOException, InterruptedException {
return user.runAs( return user.runAs(
new PrivilegedExceptionAction<JVMClusterUtil.RegionServerThread>() { new PrivilegedExceptionAction<JVMClusterUtil.RegionServerThread>() {
public JVMClusterUtil.RegionServerThread run() throws Exception { public JVMClusterUtil.RegionServerThread run() throws Exception {
return addRegionServer(index); return addRegionServer(config, index);
} }
}); });
} }
public JVMClusterUtil.MasterThread addMaster() throws IOException { 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 { throws IOException {
// Create each master with its own Configuration instance so each has // Create each master with its own Configuration instance so each has
// its HConnection instance rather than share (see HBASE_INSTANCES down in // its HConnection instance rather than share (see HBASE_INSTANCES down in
// the guts of HConnectionManager. // the guts of HConnectionManager.
JVMClusterUtil.MasterThread mt = JVMClusterUtil.MasterThread mt =
JVMClusterUtil.createMasterThread(new Configuration(this.conf), JVMClusterUtil.createMasterThread(c,
this.masterClass, index); this.masterClass, index);
this.masterThreads.add(mt); this.masterThreads.add(mt);
return mt; return mt;
} }
public JVMClusterUtil.MasterThread addMaster( public JVMClusterUtil.MasterThread addMaster(
final int index, User user) final Configuration c, final int index, User user)
throws IOException, InterruptedException { throws IOException, InterruptedException {
return user.runAs( return user.runAs(
new PrivilegedExceptionAction<JVMClusterUtil.MasterThread>() { new PrivilegedExceptionAction<JVMClusterUtil.MasterThread>() {
public JVMClusterUtil.MasterThread run() throws Exception { 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 // manually add the regionservers as other users
for (int i=0; i<nRegionNodes; i++) { for (int i=0; i<nRegionNodes; i++) {
User user = HBaseTestingUtility.getDifferentUser(conf, Configuration rsConf = HBaseConfiguration.create(conf);
User user = HBaseTestingUtility.getDifferentUser(rsConf,
".hfs."+index++); ".hfs."+index++);
hbaseCluster.addRegionServer(i, user); hbaseCluster.addRegionServer(rsConf, i, user);
} }
hbaseCluster.startup(); hbaseCluster.startup();
@ -289,16 +290,13 @@ public class MiniHBaseCluster {
*/ */
public JVMClusterUtil.RegionServerThread startRegionServer() public JVMClusterUtil.RegionServerThread startRegionServer()
throws IOException { throws IOException {
final Configuration newConf = HBaseConfiguration.create(conf);
User rsUser = User rsUser =
HBaseTestingUtility.getDifferentUser(conf, ".hfs."+index++); HBaseTestingUtility.getDifferentUser(newConf, ".hfs."+index++);
JVMClusterUtil.RegionServerThread t = null; JVMClusterUtil.RegionServerThread t = null;
try { try {
t = rsUser.runAs( t = hbaseCluster.addRegionServer(
new PrivilegedExceptionAction<JVMClusterUtil.RegionServerThread>() { newConf, hbaseCluster.getRegionServers().size(), rsUser);
public JVMClusterUtil.RegionServerThread run() throws Exception {
return hbaseCluster.addRegionServer();
}
});
t.start(); t.start();
t.waitForServerOnline(); t.waitForServerOnline();
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
@ -365,9 +363,18 @@ public class MiniHBaseCluster {
* @return New RegionServerThread * @return New RegionServerThread
*/ */
public JVMClusterUtil.MasterThread startMaster() throws IOException { public JVMClusterUtil.MasterThread startMaster() throws IOException {
JVMClusterUtil.MasterThread t = this.hbaseCluster.addMaster(); Configuration c = HBaseConfiguration.create(conf);
t.start(); User user =
t.waitForServerOnline(); 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; return t;
} }