[
https://issues.apache.org/jira/browse/AMQ-9420?focusedWorklogId=901222&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-901222
]
ASF GitHub Bot logged work on AMQ-9420:
---------------------------------------
Author: ASF GitHub Bot
Created on: 23/Jan/24 15:25
Start Date: 23/Jan/24 15:25
Worklog Time Spent: 10m
Work Description: cshannon commented on code in PR #1142:
URL: https://github.com/apache/activemq/pull/1142#discussion_r1463450283
##########
activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java:
##########
@@ -1545,8 +1545,9 @@ long updateIndex(Transaction tx, KahaAddMessageCommand
command, Location locatio
if (previous == null) {
previous = sd.messageIdIndex.put(tx, command.getMessageId(), id);
if (previous == null) {
- incrementAndAddSizeToStoreStat(tx, command.getDestination(),
location.getSize());
sd.orderIndex.put(tx, priority, id, new
MessageKeys(command.getMessageId(), location));
Review Comment:
Yeah your comment was good as it made me realize that change was pointless
as I forgot the index isn't even committed until after the transaction
completes. One could argue we could wait to update the counters until after
transaction finishes but that would be a much larger change and tricky to
guarantee things are in fact still atomic since you process it later outside of
where you have the information you need and the lock. Plus the default behavior
is to shutdown the broker on IoException anyways. The current behavior has been
fine for many years so don't need to change it I don't think.
Issue Time Tracking
-------------------
Worklog Id: (was: 901222)
Time Spent: 1h (was: 50m)
> KahaDB durable subscription stats can go negative on duplicate acks
> -------------------------------------------------------------------
>
> Key: AMQ-9420
> URL: https://issues.apache.org/jira/browse/AMQ-9420
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker
> Affects Versions: 5.18.3, 6.0.1
> Reporter: Christopher L. Shannon
> Assignee: Christopher L. Shannon
> Priority: Major
> Fix For: 6.1.0, 5.18.4, 5.17.7, 6.0.2
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> AMQ-6375 added support for non blocking durable subscription statistics to
> KahaDB to track pending message count and message size metrics. By default
> this is disabled and can be enabled with the enableSubscriptionStatistics
> flag on KahaDB.
> On rare occasions I have noticed that sometimes the metrics may got negative
> or be slightly off. I found an area where it's possible if a duplicate ack
> comes in then in some scenarios the metrics may be deprecated twice. This
> issue only applies to the subscription stats and not the store statistics for
> the overall destination as those stats would only get decremented once when
> the message is removed from the order index.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)