Author: stack
Date: Fri Oct  1 20:44:36 2010
New Revision: 1003644

URL: http://svn.apache.org/viewvc?rev=1003644&view=rev
Log:
HBASE-3066 We don't put the port for hregionserver up into znode since new 
master

Modified:
    hbase/trunk/CHANGES.txt
    
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Modified: hbase/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1003644&r1=1003643&r2=1003644&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Fri Oct  1 20:44:36 2010
@@ -959,6 +959,8 @@ Release 0.21.0 - Unreleased
    HBASE-2646  Compaction requests should be prioritized to prevent blocking
                (Jeff Whiting via Stack)
    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
    HBASE-1961  HBase EC2 scripts

Modified: 
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: 
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1003644&r1=1003643&r2=1003644&view=diff
==============================================================================
--- 
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
 (original)
+++ 
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
 Fri Oct  1 20:44:36 2010
@@ -240,17 +240,10 @@ public class HRegionServer implements HR
 
   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.
   @SuppressWarnings("unused")
   private Thread regionServerThread;
 
-  private final String machineName;
-
   // Instance of the hbase executor service.
   private ExecutorService service;
 
@@ -265,19 +258,6 @@ public class HRegionServer implements HR
    * @throws 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.conf = conf;
     this.connection = HConnectionManager.getConnection(conf);
@@ -397,6 +377,13 @@ public class HRegionServer implements HR
     this.stopped = false;
 
     // 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,
         new Class<?>[]{HRegionInterface.class, HBaseRPCErrorHandler.class,
         OnlineRegions.class},
@@ -407,8 +394,7 @@ public class HRegionServer implements HR
     this.server.setErrorHandler(this);
     this.server.setQosFunction(new QosFunction());
 
-    // Address is giving a default IP for the moment. Will be changed after
-    // calling the master.
+    // HServerInfo can be amended by master.  See below in reportForDuty.
     this.serverInfo = new HServerInfo(new HServerAddress(new InetSocketAddress(
         address.getBindAddress(), this.server.getListenerAddress().getPort())),
         System.currentTimeMillis(), this.conf.getInt(
@@ -1373,7 +1359,8 @@ public class HRegionServer implements HR
         this.requestCount.set(0);
         lastMsg = System.currentTimeMillis();
         ZKUtil.setAddressAndWatch(zooKeeper, ZKUtil.joinZNode(
-            zooKeeper.rsZNode, ZKUtil.getNodeName(serverInfo)), address);
+            zooKeeper.rsZNode, ZKUtil.getNodeName(serverInfo)),
+            this.serverInfo.getServerAddress());
         this.serverInfo.setLoad(buildServerLoad());
         result = this.hbaseMaster.regionServerStartup(this.serverInfo);
         break;


Reply via email to