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


##########
activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java:
##########
@@ -526,6 +526,28 @@ public void removeAsyncMessage(ConnectionContext context, 
MessageAck ack) throws
 
         @Override
         public void addMessage(final ConnectionContext context, final Message 
message) throws IOException {
+            // A synchronous add (no future assigned yet) can race a pending
+            // asynchronous add of the same message id 
(concurrentStoreAndDispatch):
+            // the async task still holds the journal/index update while its 
message
+            // has already been counted and dispatched from the cursor cache. 
If the
+            // sync add wins the index it is assigned a real sequence, evades 
the
+            // duplicate suppression in the cursor add path, and inflates the
+            // destination statistics. Reject it here as the duplicate it is; 
the
+            // -1 marker is handled by the existing suppression in
+            // Queue.doPendingCursorAdditions.
+            if (isConcurrentStoreAndDispatchQueues()

Review Comment:
   Is it possible for multiple async adds to happen and cause a race condition 
during failover? 
   
   It looks like the code just calls put() on the asyncTaskMap and never checks 
if an existing entry is in the map.
   
   If we are adding this check here, don't we also need to add the same check 
[here](https://github.com/mattrpav/activemq/blob/e3d559b7936d68e923f37926724bbdf890d69392/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java#L321)
 and 
[here](https://github.com/mattrpav/activemq/blob/e3d559b7936d68e923f37926724bbdf890d69392/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java#L335)
 ?



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