hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r923368 - in /hadoop/hbase/trunk: ./ core/src/main/java/org/apache/hadoop/hbase/ core/src/main/java/org/apache/hadoop/hbase/zookeeper/ core/src/test/java/org/apache/hadoop/hbase/zookeeper/
Date Mon, 15 Mar 2010 18:11:29 GMT
Author: stack
Date: Mon Mar 15 18:11:29 2010
New Revision: 923368

URL: http://svn.apache.org/viewvc?rev=923368&view=rev
Log:
HBASE-2305 Client port for ZK has no default

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/HConstants.java
    hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/zookeeper/HQuorumPeer.java
    hadoop/hbase/trunk/core/src/test/java/org/apache/hadoop/hbase/zookeeper/TestHQuorumPeer.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=923368&r1=923367&r2=923368&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Mon Mar 15 18:11:29 2010
@@ -238,6 +238,7 @@ Release 0.21.0 - Unreleased
    HBASE-2287  TypeError in shell (Alexey Kovyrin via Stack)
    HBASE-2023  Client sync block can cause 1 thread of a multi-threaded client
                to block all others (Karthik Ranganathan via Stack)
+   HBASE-2305  Client port for ZK has no default (Suraj Varma via Stack)
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/HConstants.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/HConstants.java?rev=923368&r1=923367&r2=923368&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/HConstants.java (original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/HConstants.java Mon Mar
15 18:11:29 2010
@@ -93,6 +93,9 @@ public interface HConstants {
   /** Default ZooKeeper pause value. In milliseconds. */
   static final int DEFAULT_ZOOKEEPER_PAUSE = 2 * 1000;
 
+  /** default client port that the zookeeper listens on */
+  static final int DEFAULT_ZOOKEPER_CLIENT_PORT = 2181;
+
   /** Parameter name for the root dir in ZK for this cluster */
   static final String ZOOKEEPER_ZNODE_PARENT = "zookeeper.znode.parent";
 

Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/zookeeper/HQuorumPeer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/zookeeper/HQuorumPeer.java?rev=923368&r1=923367&r2=923368&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/zookeeper/HQuorumPeer.java
(original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/zookeeper/HQuorumPeer.java
Mon Mar 15 18:11:29 2010
@@ -61,6 +61,8 @@ public class HQuorumPeer implements HCon
 
   private static final String ZK_CFG_PROPERTY = "hbase.zookeeper.property.";
   private static final int ZK_CFG_PROPERTY_SIZE = ZK_CFG_PROPERTY.length();
+  private static final String ZK_CLIENT_PORT_KEY = ZK_CFG_PROPERTY
+      + "clientPort";
 
   /**
    * Parse ZooKeeper configuration from HBase XML config and run a QuorumPeer.
@@ -196,6 +198,11 @@ public class HQuorumPeer implements HCon
       }
     }
 
+    // If clientPort is not set, assign the default
+    if (zkProperties.getProperty(ZK_CLIENT_PORT_KEY) == null) {
+      zkProperties.put(ZK_CLIENT_PORT_KEY, DEFAULT_ZOOKEPER_CLIENT_PORT);
+    }
+
     // Create the server.X properties.
     int peerPort = conf.getInt("hbase.zookeeper.peerport", 2888);
     int leaderPort = conf.getInt("hbase.zookeeper.leaderport", 3888);

Modified: hadoop/hbase/trunk/core/src/test/java/org/apache/hadoop/hbase/zookeeper/TestHQuorumPeer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/test/java/org/apache/hadoop/hbase/zookeeper/TestHQuorumPeer.java?rev=923368&r1=923367&r2=923368&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/test/java/org/apache/hadoop/hbase/zookeeper/TestHQuorumPeer.java
(original)
+++ hadoop/hbase/trunk/core/src/test/java/org/apache/hadoop/hbase/zookeeper/TestHQuorumPeer.java
Mon Mar 15 18:11:29 2010
@@ -24,7 +24,9 @@ import java.io.InputStream;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestCase;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
@@ -136,4 +138,15 @@ public class TestHQuorumPeer extends HBa
     server = servers.get(Long.valueOf(0));
     assertEquals("foo.bar", server.addr.getHostName());
   }
+  
+  /**
+   * Test Case for HBASE-2305
+   */
+  public void testShouldAssignDefaultZookeeperClientPort() {
+    Configuration config = HBaseConfiguration.create();
+    config.clear();
+    Properties p = HQuorumPeer.makeZKProps(config);
+    assertNotNull(p);
+    assertEquals(2181, p.get("hbase.zookeeper.property.clientPort"));
+  }
 }



Mime
View raw message