HBASE-11140 LocalHBaseCluster should create ConsensusProvider per each server

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1594106 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2014-05-12 22:35:49 +00:00
parent 3f43b5e2cb
commit 5732ee52bc
1 changed files with 14 additions and 4 deletions

View File

@ -73,7 +73,6 @@ public class LocalHBaseCluster {
private final Class<? extends HMaster> masterClass;
private final Class<? extends HRegionServer> regionServerClass;
ConsensusProvider consensusProvider;
/**
* Constructor.
* @param conf
@ -140,7 +139,6 @@ public class LocalHBaseCluster {
final Class<? extends HRegionServer> regionServerClass)
throws IOException {
this.conf = conf;
consensusProvider = ConsensusProviderFactory.getConsensusProvider(conf);
// Always have masters and regionservers come up on port '0' so we don't
// clash over default ports.
@ -175,8 +173,14 @@ public class LocalHBaseCluster {
// 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.
// Also, create separate ConsensusProvider instance per Server.
// This is special case when we have to have more than 1 ConsensusProvider
// within 1 process.
ConsensusProvider cp = ConsensusProviderFactory.getConsensusProvider(conf);
JVMClusterUtil.RegionServerThread rst =
JVMClusterUtil.createRegionServerThread(config, consensusProvider,
JVMClusterUtil.createRegionServerThread(config, cp,
this.regionServerClass, index);
this.regionThreads.add(rst);
return rst;
@ -202,7 +206,13 @@ public class LocalHBaseCluster {
// 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(c, consensusProvider,
// Also, create separate ConsensusProvider instance per Server.
// This is special case when we have to have more than 1 ConsensusProvider
// within 1 process.
ConsensusProvider cp = ConsensusProviderFactory.getConsensusProvider(conf);
JVMClusterUtil.MasterThread mt = JVMClusterUtil.createMasterThread(c, cp,
(Class<? extends HMaster>) conf.getClass(HConstants.MASTER_IMPL, this.masterClass), index);
this.masterThreads.add(mt);
return mt;