bookkeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eolive...@apache.org
Subject bookkeeper git commit: BOOKKEEPER-1077: Allow configuration journal/ledger paths for local bookkeeper.
Date Fri, 26 May 2017 10:38:45 GMT
Repository: bookkeeper
Updated Branches:
  refs/heads/master 64bedc2f9 -> 6698912e4


BOOKKEEPER-1077: Allow configuration journal/ledger paths for local bookkeeper.

Author: Sijie Guo <sijieg@twitter.com>
Author: Robin Dhamankar <rdhamankar@twitter.com>

Reviewers: Enrico Olivelli <eolivelli@apache.org>

Closes #163 from sijie/to_string_mark


Project: http://git-wip-us.apache.org/repos/asf/bookkeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/bookkeeper/commit/6698912e
Tree: http://git-wip-us.apache.org/repos/asf/bookkeeper/tree/6698912e
Diff: http://git-wip-us.apache.org/repos/asf/bookkeeper/diff/6698912e

Branch: refs/heads/master
Commit: 6698912e4d35119a2e85a6ea3877c6771073489c
Parents: 64bedc2
Author: Sijie Guo <sijieg@twitter.com>
Authored: Fri May 26 12:38:28 2017 +0200
Committer: eolivelli <eolivelli@apache.org>
Committed: Fri May 26 12:38:28 2017 +0200

----------------------------------------------------------------------
 .../bookkeeper/conf/ServerConfiguration.java    | 21 +++++++++++++++++++-
 .../apache/bookkeeper/util/LocalBookKeeper.java | 13 +++++++++---
 2 files changed, 30 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/6698912e/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
index ab8bbaa..d018409 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
@@ -604,6 +604,16 @@ public class ServerConfiguration extends AbstractConfiguration {
     }
 
     /**
+     * Get dir name to store journal files
+     *
+     * @return journal dir name
+     */
+    public String getJournalDirNameWithoutDefault() {
+        return this.getString(JOURNAL_DIR);
+    }
+
+
+    /**
      * Set dir name to store journal files
      *
      * @param journalDir
@@ -646,9 +656,18 @@ public class ServerConfiguration extends AbstractConfiguration {
      *
      * @return ledger dir names, if not provided return null
      */
+    public String[] getLedgerDirWithoutDefault() {
+        return this.getStringArray(LEDGER_DIRS);
+    }
+
+    /**
+     * Get dir names to store ledger data
+     *
+     * @return ledger dir names, if not provided return null
+     */
     public String[] getLedgerDirNames() {
         String[] ledgerDirs = this.getStringArray(LEDGER_DIRS);
-        if (null == ledgerDirs) {
+        if ((null == ledgerDirs) || (0 == ledgerDirs.length)) {
             return new String[] { "/tmp/bk-data" };
         }
         return ledgerDirs;

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/6698912e/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
index d9a6bcf..5dc0053 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
@@ -45,7 +45,6 @@ import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.ZooDefs.Ids;
 
 import static com.google.common.base.Charsets.UTF_8;
-import org.apache.zookeeper.data.ACL;
 
 public class LocalBookKeeper {
     protected static final Logger LOG = LoggerFactory.getLogger(LocalBookKeeper.class);
@@ -180,8 +179,16 @@ public class LocalBookKeeper {
             bsConfs[i].setBookiePort(initialPort + i);
             LOG.info("Connecting to Zookeeper at " + loopbackIPAddr + " port:" + ZooKeeperDefaultPort);
             bsConfs[i].setZkServers(loopbackIPAddr + ":" + ZooKeeperDefaultPort);
-            bsConfs[i].setJournalDirName(tmpDirs[i].getPath());
-            bsConfs[i].setLedgerDirNames(new String[] { tmpDirs[i].getPath() });
+
+            if (null == bsConfs[i].getJournalDirNameWithoutDefault()) {
+                bsConfs[i].setJournalDirName(tmpDirs[i].getPath());
+            }
+
+            String [] ledgerDirs = bsConfs[i].getLedgerDirWithoutDefault();
+            if ((null == ledgerDirs) || (0 == ledgerDirs.length)) {
+                bsConfs[i].setLedgerDirNames(new String[] { tmpDirs[i].getPath() });
+            }
+
             bsConfs[i].setAllowLoopback(true);
 
             bs[i] = new BookieServer(bsConfs[i]);


Mime
View raw message