Author: apurtell
Date: Fri May 6 17:43:02 2011
New Revision: 1100299
URL: http://svn.apache.org/viewvc?rev=1100299&view=rev
Log:
HBASE-3861 MiniZooKeeperCluster should refer to maxClientCnxns
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java
hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
hbase/trunk/src/test/resources/hbase-site.xml
Modified: hbase/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1100299&r1=1100298&r2=1100299&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Fri May 6 17:43:02 2011
@@ -100,6 +100,8 @@ Release 0.91.0 - Unreleased
HBASE-3849 Fix master ui; hbase-1502 broke requests/second
HBASE-3853 Fix TestInfoServers to pass after HBASE-3835 (todd)
HBASE-3862 Race conditions in aggregate calculation (John Heitmann)
+ HBASE-3861 MiniZooKeeperCluster should refer to maxClientCnxns (Eugene
+ Koontz via Andrew Purtell)
IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java?rev=1100299&r1=1100298&r2=1100299&view=diff
==============================================================================
---
hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java
(original)
+++
hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java
Fri May 6 17:43:02 2011
@@ -33,7 +33,9 @@ import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileUtil;
+import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.zookeeper.server.NIOServerCnxn;
import org.apache.zookeeper.server.ZooKeeperServer;
import org.apache.zookeeper.server.persistence.FileTxnLog;
@@ -61,9 +63,17 @@ public class MiniZooKeeperCluster {
private int activeZKServerIndex;
private int tickTime = 0;
+ private Configuration configuration;
+
/** Create mini ZooKeeper cluster. */
public MiniZooKeeperCluster() {
+ this(HBaseConfiguration.create());
+ }
+
+ /** Create mini ZooKeeper cluster. */
+ public MiniZooKeeperCluster(Configuration configuration) {
this.started = false;
+ this.configuration = configuration;
activeZKServerIndex = -1;
zooKeeperServers = new ArrayList<ZooKeeperServer>();
clientPortList = new ArrayList<Integer>();
@@ -131,12 +141,13 @@ public class MiniZooKeeperCluster {
} else {
tickTimeToUse = TICK_TIME;
}
+ int numberOfConnections =
this.configuration.getInt("hbase.zookeeper.property.maxClientCnxns",5000);
ZooKeeperServer server = new ZooKeeperServer(dir, dir, tickTimeToUse);
NIOServerCnxn.Factory standaloneServerFactory;
while (true) {
try {
standaloneServerFactory =
- new NIOServerCnxn.Factory(new InetSocketAddress(clientPort));
+ new NIOServerCnxn.Factory(new InetSocketAddress(clientPort),
numberOfConnections);
} catch (BindException e) {
LOG.info("Failed binding ZK Server to client port: " + clientPort);
//this port is already in use. try to use another
Modified:
hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1100299&r1=1100298&r2=1100299&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
Fri May 6 17:43:02 2011
@@ -280,7 +280,7 @@ public class HBaseTestingUtility {
if (this.zkCluster != null) {
throw new IOException("Cluster already running at " + dir);
}
- this.zkCluster = new MiniZooKeeperCluster();
+ this.zkCluster = new MiniZooKeeperCluster(this.getConfiguration());
int clientPort = this.zkCluster.startup(dir,zooKeeperServerNum);
this.conf.set("hbase.zookeeper.property.clientPort",
Integer.toString(clientPort));
Modified: hbase/trunk/src/test/resources/hbase-site.xml
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/test/resources/hbase-site.xml?rev=1100299&r1=1100298&r2=1100299&view=diff
==============================================================================
--- hbase/trunk/src/test/resources/hbase-site.xml (original)
+++ hbase/trunk/src/test/resources/hbase-site.xml Fri May 6 17:43:02 2011
@@ -146,4 +146,14 @@
version is X.X.X-SNAPSHOT"
</description>
</property>
+ <property>
+ <name>hbase.zookeeper.property.maxClientCnxns</name>
+ <value>5000</value>
+ <description>Property from ZooKeeper's config zoo.cfg.
+ Limit on number of concurrent connections (at the socket level) that a
+ single client, identified by IP address, may make to a single member of
+ the ZooKeeper ensemble. Set high to avoid zk connection issues running
+ standalone and pseudo-distributed.
+ </description>
+ </property>
</configuration>