activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1236905 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/store/kahadb/ test/java/org/apache/activemq/store/kahadb/ test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/
Date Fri, 27 Jan 2012 22:02:14 GMT
Author: gtully
Date: Fri Jan 27 22:02:13 2012
New Revision: 1236905

URL: http://svn.apache.org/viewvc?rev=1236905&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3467 - fix auto upgrade from version 3 to version
4 of kahaDb, existing durable subs messages were lost, additional test

Added:
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db-1.log
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db.data
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db.redo
Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/KahaDBVersionTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java?rev=1236905&r1=1236904&r2=1236905&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
Fri Jan 27 22:02:13 2012
@@ -1572,7 +1572,7 @@ public abstract class MessageDatabase ex
 
     protected class StoredDestinationMarshaller extends VariableMarshaller<StoredDestination>
{
 
-        public StoredDestination readPayload(DataInput dataIn) throws IOException {
+        public StoredDestination readPayload(final DataInput dataIn) throws IOException {
             final StoredDestination value = new StoredDestination();
             value.orderIndex.defaultPriorityIndex = new BTreeIndex<Long, MessageKeys>(pageFile,
dataIn.readLong());
             value.locationIndex = new BTreeIndex<Location, Long>(pageFile, dataIn.readLong());
@@ -1581,14 +1581,14 @@ public abstract class MessageDatabase ex
             if (dataIn.readBoolean()) {
                 value.subscriptions = new BTreeIndex<String, KahaSubscriptionCommand>(pageFile,
dataIn.readLong());
                 value.subscriptionAcks = new BTreeIndex<String, LastAck>(pageFile,
dataIn.readLong());
-                if (metadata.version >= VERSION) {
+                if (metadata.version >= 4) {
                     value.ackPositions = new ListIndex<String, SequenceSet>(pageFile,
dataIn.readLong());
                 } else {
                     // upgrade
                     pageFile.tx().execute(new Transaction.Closure<IOException>() {
                         public void execute(Transaction tx) throws IOException {
                             BTreeIndex<Long, HashSet<String>> oldAckPositions
=
-                                new BTreeIndex<Long, HashSet<String>>(pageFile,
tx.allocate());
+                                new BTreeIndex<Long, HashSet<String>>(pageFile,
dataIn.readLong());
                             oldAckPositions.setKeyMarshaller(LongMarshaller.INSTANCE);
                             oldAckPositions.setValueMarshaller(HashSetStringMarshaller.INSTANCE);
                             oldAckPositions.load(tx);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/KahaDBVersionTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/KahaDBVersionTest.java?rev=1236905&r1=1236904&r2=1236905&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/KahaDBVersionTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/KahaDBVersionTest.java
Fri Jan 27 22:02:13 2012
@@ -38,6 +38,7 @@ public class KahaDBVersionTest extends T
     static final Logger LOG = LoggerFactory.getLogger(KahaDBVersionTest.class);
     final static File VERSION_1_DB= new File("src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion1");
     final static File VERSION_2_DB= new File("src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion2");
+    final static File VERSION_3_DB= new File("src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3");
 
     BrokerService broker = null;
 
@@ -102,6 +103,10 @@ public class KahaDBVersionTest extends T
           doConvertRestartCycle(VERSION_2_DB);
     }
 
+    public void testVersion3Conversion() throws Exception{
+          doConvertRestartCycle(VERSION_3_DB);
+    }
+
     public void doConvertRestartCycle(File existingStore) throws Exception {
 
         File testDir = new File("target/activemq-data/kahadb/versionDB");

Added: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db-1.log
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db-1.log?rev=1236905&view=auto
==============================================================================
Files activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db-1.log
(added) and activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db-1.log
Fri Jan 27 22:02:13 2012 differ

Added: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db.data
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db.data?rev=1236905&view=auto
==============================================================================
Files activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db.data
(added) and activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db.data
Fri Jan 27 22:02:13 2012 differ

Added: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db.redo
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db.redo?rev=1236905&view=auto
==============================================================================
Files activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db.redo
(added) and activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/store/kahadb/KahaDBVersion3/db.redo
Fri Jan 27 22:02:13 2012 differ



Mime
View raw message