Skip to content

Commit

Permalink
fix: ensure we combine message stats correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
korthout committed Jan 25, 2024
1 parent 4121242 commit 3fefa7f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,14 @@ private void tryMoveDataToMessageStatsColumnFamily(final DbBytes key, final DbBy

// it could be that there are already stats known for this key, in that case we don't want to
// override it, but merge the values. For a count we can do so by simply adding the values.

// Note that we have to read the current value first, as the messagesDeadlineCount will receive
// a different value when looking up the current value.
final long valueToMove = messagesDeadlineCount.getValue();
final var currentCount = messageStatsColumnFamily.get(messagesDeadlineCountKey);
if (currentCount != null) {
LOG.trace(
"Found existing message stats entry with key [{}] and value [{}]", key, currentCount);
messagesDeadlineCount.wrapLong(messagesDeadlineCount.getValue() + currentCount.getValue());
messagesDeadlineCount.wrapLong(valueToMove + currentCount.getValue());
}

moveEntryFromRecoveryColumnFamilyToMessageStatsColumnFamily(
Expand Down

0 comments on commit 3fefa7f

Please sign in to comment.