Updated Branches: refs/heads/master 9a65fbecb -> 969c2e171
Fixed BLUR-154 Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/969c2e17 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/969c2e17 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/969c2e17 Branch: refs/heads/master Commit: 969c2e171e2e66482b1d9c967f36d5a7ccb0e0ea Parents: 9a65fbe Author: Aaron McCurry <[email protected]> Authored: Wed Jun 26 15:15:29 2013 -0400 Committer: Aaron McCurry <[email protected]> Committed: Wed Jun 26 15:15:29 2013 -0400 ---------------------------------------------------------------------- .../org/apache/blur/thrift/ThriftBlurControllerServer.java | 7 ++++++- .../java/org/apache/blur/thrift/ThriftBlurShardServer.java | 6 +++++- .../src/main/java/org/apache/blur/utils/BlurConstants.java | 2 ++ .../src/main/java/org/apache/blur/zookeeper/ZkUtils.java | 9 ++------- blur-util/src/main/resources/blur-default.properties | 1 + 5 files changed, 16 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/969c2e17/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java index 36bcc38..4fea26e 100644 --- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java +++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java @@ -35,6 +35,8 @@ import static org.apache.blur.utils.BlurConstants.BLUR_GUI_CONTROLLER_PORT; import static org.apache.blur.utils.BlurConstants.BLUR_GUI_SHARD_PORT; import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_BIND_PORT; import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_CONNECTION; +import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_TIMEOUT; +import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_TIMEOUT_DEFAULT; import static org.apache.blur.utils.BlurUtil.quietClose; import org.apache.blur.BlurConfiguration; @@ -60,6 +62,7 @@ public class ThriftBlurControllerServer extends ThriftServer { private static final Log LOG = LogFactory.getLog(ThriftBlurControllerServer.class); + public static void main(String[] args) throws Exception { int serverIndex = getServerIndex(args); LOG.info("Setting up Controller Server"); @@ -85,8 +88,10 @@ public class ThriftBlurControllerServer extends ThriftServer { String zkConnectionStr = isEmpty(configuration.get(BLUR_ZOOKEEPER_CONNECTION), BLUR_ZOOKEEPER_CONNECTION); BlurQueryChecker queryChecker = new BlurQueryChecker(configuration); + + int sessionTimeout = configuration.getInt(BLUR_ZOOKEEPER_TIMEOUT, BLUR_ZOOKEEPER_TIMEOUT_DEFAULT); - final ZooKeeper zooKeeper = ZkUtils.newZooKeeper(zkConnectionStr); + final ZooKeeper zooKeeper = ZkUtils.newZooKeeper(zkConnectionStr, sessionTimeout); //@TODO this is confusing because controllers are in a cluster by default, but they see all the shards clusters. BlurUtil.setupZookeeper(zooKeeper, BlurConstants.BLUR_CLUSTER); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/969c2e17/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java index f80cf81..cd3188c 100644 --- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java +++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java @@ -34,6 +34,8 @@ import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_OPENER_THREAD_COUNT import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_SAFEMODEDELAY; import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_SERVER_THRIFT_THREAD_COUNT; import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_CONNECTION; +import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_TIMEOUT; +import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_TIMEOUT_DEFAULT; import static org.apache.blur.utils.BlurUtil.quietClose; import java.lang.management.ManagementFactory; @@ -164,7 +166,9 @@ public class ThriftBlurShardServer extends ThriftServer { BlurQueryChecker queryChecker = new BlurQueryChecker(configuration); - final ZooKeeper zooKeeper = ZkUtils.newZooKeeper(zkConnectionStr); + int sessionTimeout = configuration.getInt(BLUR_ZOOKEEPER_TIMEOUT, BLUR_ZOOKEEPER_TIMEOUT_DEFAULT); + + final ZooKeeper zooKeeper = ZkUtils.newZooKeeper(zkConnectionStr, sessionTimeout); BlurUtil.setupZookeeper(zooKeeper, configuration.get(BLUR_CLUSTER_NAME)); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/969c2e17/blur-util/src/main/java/org/apache/blur/utils/BlurConstants.java ---------------------------------------------------------------------- diff --git a/blur-util/src/main/java/org/apache/blur/utils/BlurConstants.java b/blur-util/src/main/java/org/apache/blur/utils/BlurConstants.java index e797073..28ee666 100644 --- a/blur-util/src/main/java/org/apache/blur/utils/BlurConstants.java +++ b/blur-util/src/main/java/org/apache/blur/utils/BlurConstants.java @@ -38,6 +38,8 @@ public class BlurConstants { public static final String BLUR_TABLE_PATH = "blur.table.path"; public static final String BLUR_ZOOKEEPER_CONNECTION = "blur.zookeeper.connection"; + public static final String BLUR_ZOOKEEPER_TIMEOUT = "blur.zookeeper.timeout"; + public static final int BLUR_ZOOKEEPER_TIMEOUT_DEFAULT = 30000; public static final String BLUR_SHARD_HOSTNAME = "blur.shard.hostname"; public static final String BLUR_SHARD_BIND_PORT = "blur.shard.bind.port"; public static final String BLUR_SHARD_BIND_ADDRESS = "blur.shard.bind.address"; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/969c2e17/blur-util/src/main/java/org/apache/blur/zookeeper/ZkUtils.java ---------------------------------------------------------------------- diff --git a/blur-util/src/main/java/org/apache/blur/zookeeper/ZkUtils.java b/blur-util/src/main/java/org/apache/blur/zookeeper/ZkUtils.java index 6998814..e82e645 100644 --- a/blur-util/src/main/java/org/apache/blur/zookeeper/ZkUtils.java +++ b/blur-util/src/main/java/org/apache/blur/zookeeper/ZkUtils.java @@ -32,16 +32,12 @@ import org.apache.zookeeper.ZooDefs.Ids; import org.apache.zookeeper.ZooKeeper; import org.apache.zookeeper.data.Stat; - -/** @author Aaron McCurry ([email protected]) */ public class ZkUtils { private final static Log LOG = LogFactory.getLog(ZkUtils.class); public static final int ANY_VERSION = -1; - public static final int DEFAULT_ZK_SESSION_TIMEOUT = 60000; - public static class ConnectionWatcher implements Watcher { private String zkConnectionString; @@ -72,9 +68,8 @@ public class ZkUtils { } } } - - public static ZooKeeper newZooKeeper(String zkConnectionString) throws IOException { - int sessionTimeout = DEFAULT_ZK_SESSION_TIMEOUT; + + public static ZooKeeper newZooKeeper(String zkConnectionString, int sessionTimeout) throws IOException { ConnectionWatcher watcher = new ConnectionWatcher(); watcher.setSessionTimeout(sessionTimeout); watcher.setZkConnectionString(zkConnectionString); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/969c2e17/blur-util/src/main/resources/blur-default.properties ---------------------------------------------------------------------- diff --git a/blur-util/src/main/resources/blur-default.properties b/blur-util/src/main/resources/blur-default.properties index 0412786..9a703d8 100644 --- a/blur-util/src/main/resources/blur-default.properties +++ b/blur-util/src/main/resources/blur-default.properties @@ -55,6 +55,7 @@ blur.query.max.row.fetch=100 blur.query.max.record.fetch=1000 blur.zookeeper.system.time.tolerance=3000 +blur.zookeeper.timeout=30000 blur.gui.controller.port=40080 blur.gui.shard.port=40090
