qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1602441 - /qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java
Date Fri, 13 Jun 2014 14:26:15 GMT
Author: kwall
Date: Fri Jun 13 14:26:15 2014
New Revision: 1602441

URL: http://svn.apache.org/r1602441
Log:
QPID-5801: [Java Broker] BDB HA - ensure that replication exceptions when reading the message
id sequence cause the environment to restart

Addresses review comment from Alex Rudyy.

Modified:
    qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java

Modified: qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java?rev=1602441&r1=1602440&r2=1602441&view=diff
==============================================================================
--- qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java
(original)
+++ qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java
Fri Jun 13 14:26:15 2014
@@ -644,10 +644,7 @@ public class BDBConfigurationStore imple
         public <T extends StorableMessageMetaData> StoredMessage<T> addMessage(T
metaData)
         {
 
-            Sequence mmdSeq = _environmentFacade.openSequence(getMessageMetaDataSeqDb(),
-                                                              MESSAGE_METADATA_SEQ_KEY,
-                                                              MESSAGE_METADATA_SEQ_CONFIG);
-            long newMessageId = mmdSeq.get(null, 1);
+            long newMessageId = getNextMessageSequenceNumber();
 
             if (metaData.isPersistent())
             {
@@ -659,6 +656,26 @@ public class BDBConfigurationStore imple
             }
         }
 
+        private long getNextMessageSequenceNumber()
+        {
+            long newMessageId;
+            try
+            {
+                // The implementations of sequences mean that there is only a transaction
+                // after every n sequence values, where n is the MESSAGE_METADATA_SEQ_CONFIG.getCacheSize()
+
+                Sequence mmdSeq = _environmentFacade.openSequence(getMessageMetaDataSeqDb(),
+                                                                  MESSAGE_METADATA_SEQ_KEY,
+                                                                  MESSAGE_METADATA_SEQ_CONFIG);
+                newMessageId = mmdSeq.get(null, 1);
+            }
+            catch (DatabaseException de)
+            {
+                throw _environmentFacade.handleDatabaseException("Cannot get sequence value
for new message", de);
+            }
+            return newMessageId;
+        }
+
         @Override
         public boolean isPersistent()
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message