From ed7b0622feeee6342d99cb4e727c8a1a1ba1e36f Mon Sep 17 00:00:00 2001 From: Uma Maheswara Rao G Date: Wed, 30 May 2012 19:17:35 +0000 Subject: [PATCH] HDFS-3468. Make BKJM-ZK session timeout configurable. Contributed by Uma Maheswara Rao G. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1344423 13f79535-47bb-0310-9956-ffa450edef68 --- .../contrib/bkjournal/BookKeeperJournalManager.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/bkjournal/src/main/java/org/apache/hadoop/contrib/bkjournal/BookKeeperJournalManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/bkjournal/src/main/java/org/apache/hadoop/contrib/bkjournal/BookKeeperJournalManager.java index e3a83e07473..97553172fea 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/bkjournal/src/main/java/org/apache/hadoop/contrib/bkjournal/BookKeeperJournalManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/bkjournal/src/main/java/org/apache/hadoop/contrib/bkjournal/BookKeeperJournalManager.java @@ -91,6 +91,10 @@ import org.apache.commons.logging.LogFactory; * Default is 2. *
  • dfs.namenode.bookkeeperjournal.digestPw * Password to use when creating ledgers.
  • + *
  • dfs.namenode.bookkeeperjournal.zk.session.timeout + * Session timeout for Zookeeper client from BookKeeper Journal Manager. + * Hadoop recommends that, this value should be less than the ZKFC + * session timeout value. Default value is 3000.
  • * */ public class BookKeeperJournalManager implements JournalManager { @@ -113,6 +117,10 @@ public class BookKeeperJournalManager implements JournalManager { public static final String BKJM_BOOKKEEPER_DIGEST_PW_DEFAULT = ""; private static final int BKJM_LAYOUT_VERSION = -1; + + public static final String BKJM_ZK_SESSION_TIMEOUT + = "dfs.namenode.bookkeeperjournal.zk.session.timeout"; + public static final int BKJM_ZK_SESSION_TIMEOUT_DEFAULT = 3000; private final ZooKeeper zkc; private final Configuration conf; @@ -162,7 +170,8 @@ public class BookKeeperJournalManager implements JournalManager { try { zkConnectLatch = new CountDownLatch(1); - zkc = new ZooKeeper(zkConnect, 3000, new ZkConnectionWatcher()); + zkc = new ZooKeeper(zkConnect, conf.getInt(BKJM_ZK_SESSION_TIMEOUT, + BKJM_ZK_SESSION_TIMEOUT_DEFAULT), new ZkConnectionWatcher()); if (!zkConnectLatch.await(6000, TimeUnit.MILLISECONDS)) { throw new IOException("Error connecting to zookeeper"); }