hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmhs...@apache.org
Subject svn commit: r1307087 - in /hbase/branches/0.92: CHANGES.txt src/main/java/org/apache/hadoop/hbase/HConstants.java src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java
Date Thu, 29 Mar 2012 20:05:50 GMT
Author: jmhsieh
Date: Thu Mar 29 20:05:50 2012
New Revision: 1307087

URL: http://svn.apache.org/viewvc?rev=1307087&view=rev
Log:
HBASE-5638 Readability improvements and backport HBASE-5633: NPE reading ZK config in HBase
(Matteo Bertozzi)

Modified:
    hbase/branches/0.92/CHANGES.txt
    hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/HConstants.java
    hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java
    hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java

Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1307087&r1=1307086&r2=1307087&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Thu Mar 29 20:05:50 2012
@@ -19,6 +19,7 @@ Release 0.92.2 - Unreleased
    HBASE-5596  Few minor bugs from HBASE-5209 (David S. Wang)
    HBASE-5669  AggregationClient fails validation for open stoprow scan
                (Mubarak Seyed)
+   HBASE-5638  Backport HBASE-5633: NPE reading ZK config in HBase (Matteo Bertozzi)
 
   IMPROVEMENTS
    HBASE-5592  Make it easier to get a table from shell (Ben West)

Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/HConstants.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/HConstants.java?rev=1307087&r1=1307086&r2=1307087&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/HConstants.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/HConstants.java Thu Mar 29 20:05:50
2012
@@ -73,10 +73,13 @@ public final class HConstants {
   public static final String HBASE_MASTER_LOADBALANCER_CLASS = "hbase.master.loadbalancer.class";
 
   /** Cluster is standalone or pseudo-distributed */
-  public static final String CLUSTER_IS_LOCAL = "false";
+  public static final boolean CLUSTER_IS_LOCAL = false;
 
   /** Cluster is fully-distributed */
-  public static final String CLUSTER_IS_DISTRIBUTED = "true";
+  public static final boolean CLUSTER_IS_DISTRIBUTED = true;
+
+  /** Default value for cluster distributed mode */
+  public static final boolean DEFAULT_CLUSTER_DISTRIBUTED = CLUSTER_IS_LOCAL;
 
   /** default host address */
   public static final String DEFAULT_HOST = "0.0.0.0";

Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java?rev=1307087&r1=1307086&r2=1307087&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java Thu Mar
29 20:05:50 2012
@@ -430,8 +430,8 @@ public class LocalHBaseCluster {
    * @return True if a 'local' address in hbase.master value.
    */
   public static boolean isLocal(final Configuration c) {
-    final String mode = c.get(HConstants.CLUSTER_DISTRIBUTED);
-    return mode == null || mode.equals(HConstants.CLUSTER_IS_LOCAL);
+    boolean mode = c.getBoolean(HConstants.CLUSTER_DISTRIBUTED, HConstants.DEFAULT_CLUSTER_DISTRIBUTED);
+    return(mode == HConstants.CLUSTER_IS_LOCAL);
   }
 
   /**
@@ -449,4 +449,4 @@ public class LocalHBaseCluster {
     admin.createTable(htd);
     cluster.shutdown();
   }
-}
\ No newline at end of file
+}

Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java?rev=1307087&r1=1307086&r2=1307087&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java Thu
Mar 29 20:05:50 2012
@@ -163,8 +163,8 @@ public class ZKConfig {
       }
       // Special case for 'hbase.cluster.distributed' property being 'true'
       if (key.startsWith("server.")) {
-        if (conf.get(HConstants.CLUSTER_DISTRIBUTED).equals(HConstants.CLUSTER_IS_DISTRIBUTED)
-            && value.startsWith("localhost")) {
+        boolean mode = conf.getBoolean(HConstants.CLUSTER_DISTRIBUTED, HConstants.DEFAULT_CLUSTER_DISTRIBUTED);
+        if (mode == HConstants.CLUSTER_IS_DISTRIBUTED && value.startsWith("localhost"))
{
           String msg = "The server in zoo.cfg cannot be set to localhost " +
               "in a fully-distributed setup because it won't be reachable. " +
               "See \"Getting Started\" for more information.";



Mime
View raw message