You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2008/07/03 20:12:07 UTC
svn commit: r673748 - in /hadoop/hbase/trunk: CHANGES.txt
src/java/org/apache/hadoop/hbase/HServerInfo.java
src/java/org/apache/hadoop/hbase/master/HMaster.java
src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Author: stack
Date: Thu Jul 3 11:12:06 2008
New Revision: 673748
URL: http://svn.apache.org/viewvc?rev=673748&view=rev
Log:
HBASE-710 Find out why users have network problems in HBase and not in Hadoop
Modified:
hadoop/hbase/trunk/CHANGES.txt
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HServerInfo.java
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/HMaster.java
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=673748&r1=673747&r2=673748&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Thu Jul 3 11:12:06 2008
@@ -164,6 +164,8 @@
multiple families (Clint Morgan via Jim Kellerman)
HBASE-534 Double-assignment at SPLIT-time
HBASE-712 midKey found compacting is the first, not necessarily the optimal
+ HBASE-719 Find out why users have network problems in HBase and not in Hadoop
+ and HConnectionManager (Jean-Daniel Cryans via Stack)
IMPROVEMENTS
HBASE-559 MR example job to count table rows
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HServerInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HServerInfo.java?rev=673748&r1=673747&r2=673748&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HServerInfo.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HServerInfo.java Thu Jul 3 11:12:06 2008
@@ -87,6 +87,14 @@
public HServerAddress getServerAddress() {
return serverAddress;
}
+
+ /**
+ * Change the server address.
+ * @param serverAddress New server address
+ */
+ public void setServerAddress(HServerAddress serverAddress) {
+ this.serverAddress = serverAddress;
+ }
/** @return the server start code */
public long getStartCode() {
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/HMaster.java?rev=673748&r1=673747&r2=673748&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/HMaster.java Thu Jul 3 11:12:06 2008
@@ -529,6 +529,11 @@
@SuppressWarnings("unused")
public MapWritable regionServerStartup(HServerInfo serverInfo)
throws IOException {
+ // Set the address for now even tho it will not be persisted on
+ // the HRS side.
+ String rsAddress = Server.getRemoteAddress();
+ serverInfo.setServerAddress(new HServerAddress
+ (rsAddress, serverInfo.getServerAddress().getPort()));
// register with server manager
serverManager.regionServerStartup(serverInfo);
// send back some config info
@@ -541,6 +546,12 @@
*/
protected MapWritable createConfigurationSubset() {
MapWritable mw = addConfig(new MapWritable(), HConstants.HBASE_DIR);
+ // Get the real address of the HRS.
+ String rsAddress = Server.getRemoteAddress();
+ if (rsAddress != null) {
+ mw.put(new Text("hbase.regionserver.address"), new Text(rsAddress));
+ }
+
return addConfig(mw, "fs.default.name");
}
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=673748&r1=673747&r2=673748&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Thu Jul 3 11:12:06 2008
@@ -23,7 +23,6 @@
import java.lang.Thread.UncaughtExceptionHandler;
import java.lang.reflect.Constructor;
import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -88,7 +87,6 @@
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.ipc.Server;
-import org.apache.hadoop.net.DNS;
import org.apache.hadoop.util.Progressable;
import org.apache.hadoop.util.StringUtils;
@@ -248,8 +246,10 @@
this.server = HbaseRPC.getServer(this, address.getBindAddress(),
address.getPort(), conf.getInt("hbase.regionserver.handler.count", 10),
false, conf);
+ // Address is givin a default IP for the moment. Will be changed after
+ // calling the master.
this.serverInfo = new HServerInfo(new HServerAddress(
- new InetSocketAddress(getThisIP(),
+ new InetSocketAddress(DEFAULT_HOST,
this.server.getListenerAddress().getPort())), System.currentTimeMillis(),
this.conf.getInt("hbase.regionserver.info.port", 60030));
this.numRegionsToReport =
@@ -487,6 +487,12 @@
}
this.conf.set(key, value);
}
+ // Master may have sent us a new address with the other configs.
+ // Update our address in this case. See HBASE-719
+ if(conf.get("hbase.regionserver.address") != null)
+ serverInfo.setServerAddress(new HServerAddress
+ (conf.get("hbase.regionserver.address"),
+ serverInfo.getServerAddress().getPort()));
// Master sent us hbase.rootdir to use. Should be fully qualified
// path with file system specification included. Set 'fs.default.name'
// to match the filesystem on hbase.rootdir else underlying hadoop hdfs
@@ -522,7 +528,8 @@
private HLog setupHLog() throws RegionServerRunningException,
IOException {
- Path logdir = new Path(rootDir, "log" + "_" + getThisIP() + "_" +
+ Path logdir = new Path(rootDir, "log" + "_" +
+ serverInfo.getServerAddress().getBindAddress() + "_" +
this.serverInfo.getStartCode() + "_" +
this.serverInfo.getServerAddress().getPort());
if (LOG.isDebugEnabled()) {
@@ -625,16 +632,6 @@
return this.log;
}
- /*
- * Use interface to get the 'real' IP for this host. 'serverInfo' is sent to
- * master. Should have the real IP of this host rather than 'localhost' or
- * 0.0.0.0 or 127.0.0.1 in it.
- * @return This servers' IP.
- */
- private String getThisIP() throws UnknownHostException {
- return DNS.getDefaultIP(conf.get("hbase.regionserver.dns.interface","default"));
- }
-
/**
* Sets a flag that will cause all the HRegionServer threads to shut down
* in an orderly fashion. Used by unit tests.