[rhmessaging-commits] rhmessaging commits: r4284 - store/branches/java/0.5.x-dev/src/tools/java/org/apache/qpid/server/store/berkeleydb.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Sep 14 10:23:37 EDT 2010


Author: rgemmell
Date: 2010-09-14 10:23:36 -0400 (Tue, 14 Sep 2010)
New Revision: 4284

Modified:
   store/branches/java/0.5.x-dev/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java
Log:
Allow the upgrade tool to ignore the exception raised (after the schema upgrade has been performed and new store created+closed) when closing the old read-only BDB3.3 store and BDB4 tries to clean it despite it being read-only


Modified: store/branches/java/0.5.x-dev/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java
===================================================================
--- store/branches/java/0.5.x-dev/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java	2010-09-14 13:50:43 UTC (rev 4283)
+++ store/branches/java/0.5.x-dev/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java	2010-09-14 14:23:36 UTC (rev 4284)
@@ -89,6 +89,8 @@
     VirtualHost _oldVirtualHost;
     /** The file ending that is used by BDB Store Files */
     private static final String BDB_FILE_ENDING = ".jdb";
+    /** Message of Exception thrown when closing down a read-only BDB3.3 store when using BDB4 */
+    private static final String NO_CLEAN_READ_ONLY = "Log cleaning not allowed in a read-only or memory-only environment";
 
     static final Options _options = new Options();
     static CommandLine _commandLine;
@@ -368,7 +370,25 @@
             _oldVirtualHost.close();
 
             _newMessageStore.close();
-            _oldMessageStore.close();
+            try
+            {
+                _oldMessageStore.close();
+            }
+            catch(UnsupportedOperationException e)
+            {
+                //When closing the old BDB3.3store, BDB4 will try to clean the logs 
+                //upgrade them and then throw an UnsupportedOperationException
+                String msg = e.getMessage();
+                
+                if(e !=null && msg.endsWith(NO_CLEAN_READ_ONLY))
+                {
+                    //ignore, expected
+                }
+                else
+                {
+                    throw e;
+                }
+            }
 
             //Shutdown the AR that the Vhosts will have created.
             ApplicationRegistry.remove(1);



More information about the rhmessaging-commits mailing list