bookkeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject bookkeeper git commit: BOOKKEEPER-813: BookieShell doesn't find index directory (Charles Xie via sijie)
Date Sat, 06 Dec 2014 06:49:41 GMT
Repository: bookkeeper
Updated Branches:
  refs/heads/branch-4.3 3c8633922 -> 651bc61fd


BOOKKEEPER-813: BookieShell doesn't find index directory (Charles Xie via sijie)


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

Branch: refs/heads/branch-4.3
Commit: 651bc61fd88223586a97d4a370febfaba54fef7c
Parents: 3c86339
Author: Sijie Guo <sijie@apache.org>
Authored: Fri Dec 5 22:49:31 2014 -0800
Committer: Sijie Guo <sijie@apache.org>
Committed: Fri Dec 5 22:49:31 2014 -0800

----------------------------------------------------------------------
 CHANGES.txt                                      |  2 ++
 .../apache/bookkeeper/bookie/BookieShell.java    | 19 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/651bc61f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1d3f26a..8f4da25 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -20,6 +20,8 @@ Release 4.3.1 - unreleased
 
       BOOKKEEPER-820: print out fi.isFenced() in BookieShell (zhaijia via sijie)
 
+      BOOKKEEPER-813: BookieShell doesn't find index directory (Charles Xie via sijie)
+
 Release 4.3.0 - 2014-10-03
 
   Non-backward compatible changes:

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/651bc61f/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
index 8ace465..621c823 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
@@ -103,6 +103,7 @@ public class BookieShell implements Tool {
     static final String CMD_HELP = "help";
 
     final ServerConfiguration bkConf = new ServerConfiguration();
+    File[] indexDirectories;
     File[] ledgerDirectories;
     File journalDirectory;
 
@@ -1086,6 +1087,11 @@ public class BookieShell implements Tool {
                 for (File dir : ledgerDirectories) {
                     hasCookieUpdatedInDirs &= verifyCookie(newCookie, dir);
                 }
+                if (indexDirectories != ledgerDirectories) {
+                    for (File dir : indexDirectories) {
+                        hasCookieUpdatedInDirs &= verifyCookie(newCookie, dir);
+                    }
+                }
 
                 if (hasCookieUpdatedInDirs) {
                     try {
@@ -1106,6 +1112,12 @@ public class BookieShell implements Tool {
                         newCookie.writeToDirectory(dir);
                     }
                     LOG.info("Updated cookie file present in ledgerDirectories {}", ledgerDirectories);
+                    if (ledgerDirectories != indexDirectories) {
+                        for (File dir : indexDirectories) {
+                            newCookie.writeToDirectory(dir);
+                        }
+                        LOG.info("Updated cookie file present in indexDirectories {}", indexDirectories);
+                    }
                 }
                 // writes newcookie to zookeeper
                 conf.setUseHostNameAsBookieID(useHostname);
@@ -1171,6 +1183,11 @@ public class BookieShell implements Tool {
         bkConf.loadConf(conf);
         journalDirectory = Bookie.getCurrentDirectory(bkConf.getJournalDir());
         ledgerDirectories = Bookie.getCurrentDirectories(bkConf.getLedgerDirs());
+        if (null == bkConf.getIndexDirs()) {
+            indexDirectories = ledgerDirectories;
+        } else {
+            indexDirectories = Bookie.getCurrentDirectories(bkConf.getIndexDirs());
+        }
         formatter = EntryFormatter.newEntryFormatter(bkConf, ENTRY_FORMATTER_CLASS);
         LOG.debug("Using entry formatter {}", formatter.getClass().getName());
         pageSize = bkConf.getPageSize();
@@ -1252,7 +1269,7 @@ public class BookieShell implements Tool {
     private File getLedgerFile(long ledgerId) {
         String ledgerName = IndexPersistenceMgr.getLedgerName(ledgerId);
         File lf = null;
-        for (File d : ledgerDirectories) {
+        for (File d : indexDirectories) {
             lf = new File(d, ledgerName);
             if (lf.exists()) {
                 break;


Mime
View raw message