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


##########
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 am trying to remember the original PR, but I feel like we should only need 
2 methods and not 4.
   
   Shouldn't we only ever need to pass in a new MessageOrderCursor when we want 
to be isolated? For some reason the recovery() method was updated to use new 
MessageOrderCursor() but i don't see why that was 
[changed](https://github.com/apache/activemq/pull/1377/changes#diff-804376ddbeaaa7b31ef291c209f364fde5f0b2ccbe4a20c137bebc0c4cf31990R689)
 in the original PR. That method already resets it 
[here](https://github.com/apache/activemq/pull/1377/changes#diff-804376ddbeaaa7b31ef291c209f364fde5f0b2ccbe4a20c137bebc0c4cf31990R687)
   
   I would think we would only two variations of the iterator...one that tracks 
state (including the last used keys) and uses the MessageOrderCursor that is 
part of the definition and one that is completely isolated but maybe I am 
missing something.



-- 
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