cshannon commented on code in PR #2231:
URL: https://github.com/apache/activemq/pull/2231#discussion_r3617627940


##########
activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java:
##########
@@ -3848,12 +3848,34 @@ MessageKeys put(Transaction tx, int priority, Long key, 
MessageKeys value) throw
             }
         }
 
+        /**
+         * Iterate and record the last visited sequence keys
+         * (lastDefaultKey/lastHighKey/lastLowKey) so that a subsequent
+         * {@link #stoppedIterating()} advances the destination cursor past the
+         * visited messages.
+         */
         Iterator<Entry<Long, MessageKeys>> iterator(Transaction tx) throws 
IOException{
-            return new MessageOrderIterator(tx,cursor,this);
+            return new MessageOrderIterator(tx,cursor,this,true);
         }
 
         Iterator<Entry<Long, MessageKeys>> iterator(Transaction tx, 
MessageOrderCursor m) throws IOException{
-            return new MessageOrderIterator(tx,m,this);
+            return new MessageOrderIterator(tx,m,this,true);

Review Comment:
   I took a look closer and there are 2 spots that should be be using the 
isolated cursor, the 
[recover()](https://github.com/apache/activemq/blob/dce599f02be91890cdb7c26754d5f7221436fc8b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java#L652)
 method and also the [recoverExpired() 
](https://github.com/apache/activemq/blob/main/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java#L1277)
 methods. Also, both methods have a reset call that can go away, for example: 
https://github.com/apache/activemq/blob/dce599f02be91890cdb7c26754d5f7221436fc8b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java#L1283
   
   The reason it doesn't break is those other methods are used exclusively for 
Topics so it doesn't interfere with the subscription recovery as each call to 
recoverNext() for a sub resets the cursor to the correct offset anyways.
   
   Queues and durable subscriptions exclusively use the recoverNext() methods 
to keep track of state. 
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to