hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject git commit: HBASE-11880 NPE in MasterStatusServlet
Date Tue, 02 Sep 2014 21:56:24 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 211c1e8ad -> 842f4808d


HBASE-11880 NPE in MasterStatusServlet


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/842f4808
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/842f4808
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/842f4808

Branch: refs/heads/master
Commit: 842f4808db3a4951f43d958f7933e12ca9bd4830
Parents: 211c1e8
Author: Jimmy Xiang <jxiang@cloudera.com>
Authored: Tue Sep 2 12:07:19 2014 -0700
Committer: Jimmy Xiang <jxiang@cloudera.com>
Committed: Tue Sep 2 14:56:11 2014 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hbase/master/HMaster.java    | 8 ++++++--
 .../org/apache/hadoop/hbase/master/MasterStatusServlet.java  | 7 +++----
 .../org/apache/hadoop/hbase/regionserver/HRegionServer.java  | 8 ++++++--
 3 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/842f4808/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index 5024313..714b5a8 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -480,8 +480,12 @@ public class HMaster extends HRegionServer implements MasterServices,
Server {
     ZKClusterId.setClusterId(this.zooKeeper, fileSystemManager.getClusterId());
     this.serverManager = createServerManager(this, this);
 
-    metaTableLocator = new MetaTableLocator();
-    shortCircuitConnection = createShortCircuitConnection();
+    synchronized (this) {
+      if (shortCircuitConnection == null) {
+        shortCircuitConnection = createShortCircuitConnection();
+        metaTableLocator = new MetaTableLocator();
+      }
+    }
 
     // Invalidate all write locks held previously
     this.tableLockManager.reapWriteLocks();

http://git-wip-us.apache.org/repos/asf/hbase/blob/842f4808/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterStatusServlet.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterStatusServlet.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterStatusServlet.java
index 75def7b..3059096 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterStatusServlet.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterStatusServlet.java
@@ -27,8 +27,6 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.ServerName;
@@ -43,7 +41,6 @@ import org.apache.hadoop.hbase.zookeeper.MetaTableLocator;
  */
 @InterfaceAudience.Private
 public class MasterStatusServlet extends HttpServlet {
-  private static final Log LOG = LogFactory.getLog(MasterStatusServlet.class);
   private static final long serialVersionUID = 1L;
 
   @Override
@@ -88,7 +85,9 @@ public class MasterStatusServlet extends HttpServlet {
   }
 
   private ServerName getMetaLocationOrNull(HMaster master) {
-    return master.getMetaTableLocator().getMetaRegionLocation(master.getZooKeeper());
+    MetaTableLocator metaTableLocator = master.getMetaTableLocator();
+    return metaTableLocator == null ? null :
+      metaTableLocator.getMetaRegionLocation(master.getZooKeeper());
   }
 
   private Map<String, Integer> getFragmentationInfo(

http://git-wip-us.apache.org/repos/asf/hbase/blob/842f4808/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index eab29e7..7947c4a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -637,8 +637,12 @@ public class HRegionServer extends HasThread implements
       this.abort("Failed to retrieve Cluster ID",e);
     }
 
-    shortCircuitConnection = createShortCircuitConnection();
-    metaTableLocator = new MetaTableLocator();
+    synchronized (this) {
+      if (shortCircuitConnection == null) {
+        shortCircuitConnection = createShortCircuitConnection();
+        metaTableLocator = new MetaTableLocator();
+      }
+    }
 
     // watch for snapshots and other procedures
     try {


Mime
View raw message