[rhmessaging-commits] rhmessaging commits: r3270 - store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu Apr 9 08:11:12 EDT 2009


Author: ritchiem
Date: 2009-04-09 08:11:12 -0400 (Thu, 09 Apr 2009)
New Revision: 3270

Modified:
   store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
Log:
RHM-8 : Applied patch from Robert Godfrey with some additional comments

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	2009-04-08 18:33:07 UTC (rev 3269)
+++ store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java	2009-04-09 12:11:12 UTC (rev 3270)
@@ -500,8 +500,7 @@
             _log.debug("Message Id: " + messageId + " Removing");
         }
 
-        // first we need to look up the header to get the chunk count
-        MessageMetaData mmd = getMessageMetaData(context, messageId);
+        //Remove the MetaData then iterate deleting all the ContentChunks we can for the given messageId
         try
         {
             OperationStatus status = _messageMetaDataDb.delete(tx, key);
@@ -523,45 +522,21 @@
 
             DatabaseEntry contentKey = new DatabaseEntry();
             TupleBinding contentKeyBinding = new MessageContentKey.TupleBinding();
-            for (int i = 0; i < mmd.getContentChunkCount(); i++)
+            int i = 0;
+
+            do
             {
                 MessageContentKey mck = new MessageContentKey(messageId, i);
                 contentKeyBinding.objectToEntry(mck, contentKey);
-                status = _messageContentDb.get(tx, contentKey, new DatabaseEntry(), LockMode.RMW);
-                if (status == OperationStatus.NOTFOUND)
-                {
-                    if (localTx)
-                    {
-                        tx.abort();
-                        context.setPayload(null);
-                    }
-
-                    throw new AMQException("Content chunk " + i + " not found for message " + messageId);
-                }
-
                 status = _messageContentDb.delete(tx, contentKey);
-                if (status == OperationStatus.NOTFOUND)
-                {
-                    if (localTx)
-                    {
-                        tx.abort();
-                        context.setPayload(null);
-                    }
+                i++;
+            } while (status != OperationStatus.NOTFOUND);
 
-                    throw new AMQException("Content chunk " + i + " not found for message " + messageId);
-                }
-
-                if (_log.isDebugEnabled())
-                {
-                    _log.debug("Deleted content chunk " + i + " for message " + messageId);
-                }
-            }
-
             if (localTx)
             {
-                // ? Will this not perform the environment default commit? Should we not be doing this async as
+                // Should we not be doing this async as
                 // remove will only occur when message has been fully dequeued? 2009-03-31
-                tx.commit();
+                commit(tx);
                 context.setPayload(null);
             }
         }




More information about the rhmessaging-commits mailing list