zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject svn commit: r1381879 - in /zookeeper/bookkeeper/trunk: CHANGES.txt bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileSystemUpgrade.java bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpgradeTest.java
Date Fri, 07 Sep 2012 05:26:40 GMT
Author: sijie
Date: Fri Sep  7 05:26:40 2012
New Revision: 1381879

URL: http://svn.apache.org/viewvc?rev=1381879&view=rev
Log:
BOOKKEEPER-387: BookKeeper Upgrade is not working. (surendra via sijie)

Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileSystemUpgrade.java
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpgradeTest.java

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1381879&r1=1381878&r2=1381879&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Fri Sep  7 05:26:40 2012
@@ -78,6 +78,8 @@ Trunk (unreleased changes)
 
         BOOKKEEPER-395: HDFS dep transitively depends on a busted pom (Stu Hood via sijie)
 
+        BOOKKEEPER-387: BookKeeper Upgrade is not working. (surendra via sijie)
+
       hedwig-protocol:
 
         BOOKKEEPER-394: CompositeException message is not useful (Stu Hood via sijie)

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileSystemUpgrade.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileSystemUpgrade.java?rev=1381879&r1=1381878&r2=1381879&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileSystemUpgrade.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileSystemUpgrade.java
Fri Sep  7 05:26:40 2012
@@ -195,6 +195,7 @@ public class FileSystemUpgrade {
                 int version = detectPreviousVersion(d);
                 if (version == Cookie.CURRENT_COOKIE_LAYOUT_VERSION) {
                     LOG.info("Directory is current, no need to upgrade");
+                    continue;
                 }
                 try {
                     File curDir = new File(d, Bookie.CURRENT_DIR);
@@ -230,6 +231,11 @@ public class FileSystemUpgrade {
                     throw new BookieException.UpgradeException(ioe);
                 }
             }
+
+            if (deferredMoves.isEmpty()) {
+                return;
+            }
+
             try {
                 c.writeToZooKeeper(zk, conf);
             } catch (KeeperException ke) {
@@ -376,4 +382,4 @@ public class FileSystemUpgrade {
             throw new IllegalArgumentException(err);
         }
     }
-}
\ No newline at end of file
+}

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpgradeTest.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpgradeTest.java?rev=1381879&r1=1381878&r2=1381879&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpgradeTest.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/UpgradeTest.java
Fri Sep  7 05:26:40 2012
@@ -214,6 +214,23 @@ public class UpgradeTest {
     }
 
     @Test
+    public void testUpgradeCurrent() throws Exception {
+        String journalDir = newV2JournalDirectory();
+        String ledgerDir = newV2LedgerDirectory();
+        testUpgradeProceedure(zkutil.getZooKeeperConnectString(), journalDir, ledgerDir);
+        // Upgrade again
+        ServerConfiguration conf = new ServerConfiguration()
+            .setZkServers(zkutil.getZooKeeperConnectString())
+            .setJournalDirName(journalDir)
+            .setLedgerDirNames(new String[] { ledgerDir })
+            .setBookiePort(3181);
+        FileSystemUpgrade.upgrade(conf); // should work fine with current directory
+        Bookie b = new Bookie(conf);
+        b.start();
+        b.shutdown();
+    }
+
+    @Test
     public void testCommandLine() throws Exception {
         PrintStream origerr = System.err;
         PrintStream origout = System.out;



Mime
View raw message