cshannon commented on code in PR #2584:
URL: https://github.com/apache/activemq/pull/2584#discussion_r4122370513
##########
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:
That's good to know but it might be worth hardening/improving the logic
maybe in a future PR. The cursor audit cache limited to a certain size so I'm
not sure what happens If we exceeded the cache limit (or how likely that even
is, ideally the cache is sized for your use case). Either way, we should likely
be using putIfAbsent() semantics and not put() because it's an unexpected state
if the key already existed. But like I said, maybe something to address later
because the producer audit currently guards it.
--
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