hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nspiegelb...@apache.org
Subject svn commit: r1181338 - in /hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase: master/HMaster.java regionserver/HRegionServer.java
Date Tue, 11 Oct 2011 02:00:10 GMT
Author: nspiegelberg
Date: Tue Oct 11 02:00:09 2011
New Revision: 1181338

URL: http://svn.apache.org/viewvc?rev=1181338&view=rev
Log:
HBASE-2862: Name DFSClient for Improved Debugging

Reported by Hairong. We had an HDFS error on our test cluster. It was hard to debug the HDFS
NameNode logs because there was no way to map DFClient => RegionServer. Hadoop guys added
a hacky config value, mapred.task.id, which allows you to add a suffix to the DFSClient ID
for logging. We piggyback upon that for our HLog/HFile code

Modified:
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1181338&r1=1181337&r2=1181338&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Tue Oct
11 02:00:09 2011
@@ -184,6 +184,27 @@ public class HMaster extends Thread impl
     zooKeeperWrapper = ZooKeeperWrapper.createInstance(conf, HMaster.class.getName());
     isClusterStartup = (zooKeeperWrapper.scanRSDirectory().size() == 0);
 
+    // Get my address and create an rpc server instance.  The rpc-server port
+    // can be ephemeral...ensure we have the correct info
+    HServerAddress a = new HServerAddress(getMyAddress(this.conf));
+    this.rpcServer = HBaseRPC.getServer(this, a.getBindAddress(),
+      a.getPort(), conf.getInt("hbase.regionserver.handler.count", 10),
+      false, conf);
+    this.address = new HServerAddress(this.rpcServer.getListenerAddress());
+
+    this.numRetries =  conf.getInt("hbase.client.retries.number", 2);
+    this.threadWakeFrequency = conf.getInt(HConstants.THREAD_WAKE_FREQUENCY,
+        10 * 1000);
+
+    this.sleeper = new Sleeper(this.threadWakeFrequency, this.closed);
+    this.connection = ServerConnectionManager.getConnection(conf);
+
+    // hack! Maps DFSClient => Master for logs.  HDFS made this
+    // config param for task trackers, but we can piggyback off of it.
+    if (this.conf.get("mapred.task.id") == null) {
+      this.conf.set("mapred.task.id", "HMaster_" + this.address.toString());
+    }
+
     // Set filesystem to be that of this.rootdir else we get complaints about
     // mismatched filesystems if hbase.rootdir is hdfs and fs.defaultFS is
     // default localfs.  Presumption is that rootdir is fully-qualified before
@@ -202,21 +223,6 @@ public class HMaster extends Thread impl
       this.fs.mkdirs(this.oldLogDir);
     }
 
-    // Get my address and create an rpc server instance.  The rpc-server port
-    // can be ephemeral...ensure we have the correct info
-    HServerAddress a = new HServerAddress(getMyAddress(this.conf));
-    this.rpcServer = HBaseRPC.getServer(this, a.getBindAddress(),
-      a.getPort(), conf.getInt("hbase.regionserver.handler.count", 10),
-      false, conf);
-    this.address = new HServerAddress(this.rpcServer.getListenerAddress());
-
-    this.numRetries =  conf.getInt("hbase.client.retries.number", 2);
-    this.threadWakeFrequency = conf.getInt(HConstants.THREAD_WAKE_FREQUENCY,
-        10 * 1000);
-
-    this.sleeper = new Sleeper(this.threadWakeFrequency, this.closed);
-    this.connection = ServerConnectionManager.getConnection(conf);
-
     // Get our zookeeper wrapper and then try to write our address to zookeeper.
     // We'll succeed if we are only  master or if we win the race when many
     // masters.  Otherwise we park here inside in writeAddressToZooKeeper.

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1181338&r1=1181337&r2=1181338&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Tue Oct 11 02:00:09 2011
@@ -728,6 +728,14 @@ public class HRegionServer implements HR
           this.serverInfo.getServerAddress() + ", Now=" + hra);
         this.serverInfo.setServerAddress(hsa);
       }
+
+      // hack! Maps DFSClient => RegionServer for logs.  HDFS made this
+      // config param for task trackers, but we can piggyback off of it.
+      if (this.conf.get("mapred.task.id") == null) {
+        this.conf.set("mapred.task.id",
+            "HRegionServer_" + this.serverInfo.getServerAddress().toString());
+      }
+
       // Master sent us hbase.rootdir to use. Should be fully qualified
       // path with file system specification included.  Set 'fs.defaultFS'
       // to match the filesystem on hbase.rootdir else underlying hadoop hdfs



Mime
View raw message