HBASE-3066 We don't put the port for hregionserver up into znode since new master

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1003644 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-10-01 20:44:36 +00:00
parent 94682d09d3
commit 7bb6f3839c
2 changed files with 12 additions and 23 deletions

View File

@ -959,6 +959,8 @@ Release 0.21.0 - Unreleased
HBASE-2646 Compaction requests should be prioritized to prevent blocking HBASE-2646 Compaction requests should be prioritized to prevent blocking
(Jeff Whiting via Stack) (Jeff Whiting via Stack)
HBASE-3019 Make bulk assignment on cluster startup run faster HBASE-3019 Make bulk assignment on cluster startup run faster
HBASE-3066 We don't put the port for hregionserver up into znode since
new master
NEW FEATURES NEW FEATURES
HBASE-1961 HBase EC2 scripts HBASE-1961 HBase EC2 scripts

View File

@ -240,17 +240,10 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
private final long rpcTimeout; private final long rpcTimeout;
// Address passed in to constructor. This is not always the address we run
// with. For example, if passed port is 0, then we are to pick a port. The
// actual address we run with is in the #serverInfo data member.
private final HServerAddress address;
// The main region server thread. // The main region server thread.
@SuppressWarnings("unused") @SuppressWarnings("unused")
private Thread regionServerThread; private Thread regionServerThread;
private final String machineName;
// Instance of the hbase executor service. // Instance of the hbase executor service.
private ExecutorService service; private ExecutorService service;
@ -265,19 +258,6 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
* @throws InterruptedException * @throws InterruptedException
*/ */
public HRegionServer(Configuration conf) throws IOException, InterruptedException { public HRegionServer(Configuration conf) throws IOException, InterruptedException {
this.machineName = DNS.getDefaultHost(conf.get(
"hbase.regionserver.dns.interface", "default"), conf.get(
"hbase.regionserver.dns.nameserver", "default"));
String addressStr = machineName
+ ":"
+ conf.get(HConstants.REGIONSERVER_PORT, Integer
.toString(HConstants.DEFAULT_REGIONSERVER_PORT));
// This is not necessarily the address we will run with. The address we
// use will be in #serverInfo data member. For example, we may have been
// passed a port of 0 which means we should pick some ephemeral port to bind
// to.
this.address = new HServerAddress(addressStr);
this.fsOk = true; this.fsOk = true;
this.conf = conf; this.conf = conf;
this.connection = HConnectionManager.getConnection(conf); this.connection = HConnectionManager.getConnection(conf);
@ -397,6 +377,13 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
this.stopped = false; this.stopped = false;
// Server to handle client requests // Server to handle client requests
String machineName = DNS.getDefaultHost(conf.get(
"hbase.regionserver.dns.interface", "default"), conf.get(
"hbase.regionserver.dns.nameserver", "default"));
String addressStr = machineName + ":" +
conf.get(HConstants.REGIONSERVER_PORT,
Integer.toString(HConstants.DEFAULT_REGIONSERVER_PORT));
HServerAddress address = new HServerAddress(addressStr);
this.server = HBaseRPC.getServer(this, this.server = HBaseRPC.getServer(this,
new Class<?>[]{HRegionInterface.class, HBaseRPCErrorHandler.class, new Class<?>[]{HRegionInterface.class, HBaseRPCErrorHandler.class,
OnlineRegions.class}, OnlineRegions.class},
@ -407,8 +394,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
this.server.setErrorHandler(this); this.server.setErrorHandler(this);
this.server.setQosFunction(new QosFunction()); this.server.setQosFunction(new QosFunction());
// Address is giving a default IP for the moment. Will be changed after // HServerInfo can be amended by master. See below in reportForDuty.
// calling the master.
this.serverInfo = new HServerInfo(new HServerAddress(new InetSocketAddress( this.serverInfo = new HServerInfo(new HServerAddress(new InetSocketAddress(
address.getBindAddress(), this.server.getListenerAddress().getPort())), address.getBindAddress(), this.server.getListenerAddress().getPort())),
System.currentTimeMillis(), this.conf.getInt( System.currentTimeMillis(), this.conf.getInt(
@ -1373,7 +1359,8 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
this.requestCount.set(0); this.requestCount.set(0);
lastMsg = System.currentTimeMillis(); lastMsg = System.currentTimeMillis();
ZKUtil.setAddressAndWatch(zooKeeper, ZKUtil.joinZNode( ZKUtil.setAddressAndWatch(zooKeeper, ZKUtil.joinZNode(
zooKeeper.rsZNode, ZKUtil.getNodeName(serverInfo)), address); zooKeeper.rsZNode, ZKUtil.getNodeName(serverInfo)),
this.serverInfo.getServerAddress());
this.serverInfo.setLoad(buildServerLoad()); this.serverInfo.setLoad(buildServerLoad());
result = this.hbaseMaster.regionServerStartup(this.serverInfo); result = this.hbaseMaster.regionServerStartup(this.serverInfo);
break; break;