[rhmessaging-commits] rhmessaging commits: r4084 - in store/trunk/java/bdbstore/src: tools/java/org/apache/qpid/server/store/berkeleydb and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Jul 7 04:40:51 EDT 2010


Author: rgemmell
Date: 2010-07-07 04:40:50 -0400 (Wed, 07 Jul 2010)
New Revision: 4084

Modified:
   store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
   store/trunk/java/bdbstore/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java
Log:
Inform users of need to use the previous upgrade tool when they supply a v1 store for upgrade.


Modified: store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
===================================================================
--- store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java	2010-07-06 19:53:26 UTC (rev 4083)
+++ store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java	2010-07-07 08:40:50 UTC (rev 4084)
@@ -356,8 +356,8 @@
                 if (_version != 1)
                 {
                     closeEnvironment();
-                    throw new DatabaseException("Error: Attempting to start BDBStore version " + _version
-                                                + " with a version 1 store. Please Upgrade");
+                    throw new DatabaseException("Error: Unable to load BDBStore as version " + _version
+                                            + ". Store on disk contains version 1 data.");
                 }
                 else // DB is v1 and _version is v1
                 {

Modified: store/trunk/java/bdbstore/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java
===================================================================
--- store/trunk/java/bdbstore/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java	2010-07-06 19:53:26 UTC (rev 4083)
+++ store/trunk/java/bdbstore/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java	2010-07-07 08:40:50 UTC (rev 4084)
@@ -91,6 +91,11 @@
     private boolean _force;
 
     private static final String VERSION = "2.0";
+    private static final String USER_ABORTED_PROCESS = "User aborted process";
+    private static final String EXPECTED_V2_STORE_GOT_V1 = 
+                                "Error: Unable to load BDBStore as version 2. Store on disk contains version 1 data.";
+    private static final String EXPECTED_V2_STORE_GOT_V3 = 
+                                "Error: Unable to load BDBStore as version 2. Store on disk contains version 3 data.";
     private static final String OPTION_INPUT_SHORT = "i";
     private static final String OPTION_INPUT = "input";
     private static final String OPTION_OUTPUT_SHORT = "o";
@@ -239,7 +244,7 @@
             {
                 if (input.equalsIgnoreCase(ANSWER_A) || input.equalsIgnoreCase(ANSWER_ABORT))
                 {
-                    throw new RuntimeException("User aborted process");
+                    throw new RuntimeException(USER_ABORTED_PROCESS);
                 }
             }
         }
@@ -784,7 +789,7 @@
         }
         catch (RuntimeException re)
         {
-            if (!("User aborted process").equals(re.getMessage()))
+            if (!(USER_ABORTED_PROCESS).equals(re.getMessage()))
             {
                 re.printStackTrace();
                 _logger.error("Upgrade Failed: " + re.getMessage());
@@ -843,8 +848,12 @@
         }
         catch (DatabaseException de)
         {
-            if (de.getMessage().endsWith("Error: Unable to load BDBStore as version 2. Store on disk contains version 3 data."))
+            if (de.getMessage().endsWith(EXPECTED_V2_STORE_GOT_V1))
             {
+                System.out.println("Store '" + fromDir + "' is a version 1 store. You must use the previous v1 -> v2 upgrade tool before this update can proceed.");
+            }
+            else if (de.getMessage().endsWith(EXPECTED_V2_STORE_GOT_V3))
+            {
                 System.out.println("Store '" + fromDir + "' has already been upgraded to version 3.");
             }
             else
@@ -855,7 +864,7 @@
         }
         catch (RuntimeException re)
         {
-            if (!("User aborted process").equals(re.getMessage()))
+            if (!(USER_ABORTED_PROCESS).equals(re.getMessage()))
             {
                 re.printStackTrace();
                 _logger.error("Upgrade Failed: " + re.getMessage());



More information about the rhmessaging-commits mailing list