From bf24ffde886dbbec719cca18eb927dc7ebad8f12 Mon Sep 17 00:00:00 2001 From: hqbfz <125714719+3424672656@users.noreply.github.com> Date: Mon, 1 Apr 2024 10:47:35 +0800 Subject: [PATCH] [ISSUE #7979] Fix timerWheel message metric (#7980) * fix metric in TimerWheel * fix metric in TimerWheel * fix message metric in TimerWheel * fix message metric in TimerWheel --- .../org/apache/rocketmq/store/timer/TimerMessageStore.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java b/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java index 819b3e96a43..32075474b99 100644 --- a/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java +++ b/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java @@ -1556,6 +1556,8 @@ public void run() { if (null != msgExt) { if (needDelete(tr.getMagic()) && !needRoll(tr.getMagic())) { if (msgExt.getProperty(MessageConst.PROPERTY_TIMER_DEL_UNIQKEY) != null && tr.getDeleteList() != null) { + //Execute metric plus one for messages that fail to be deleted + addMetric(msgExt, 1); tr.getDeleteList().add(msgExt.getProperty(MessageConst.PROPERTY_TIMER_DEL_UNIQKEY)); } tr.idempotentRelease(); @@ -1566,6 +1568,8 @@ public void run() { LOGGER.warn("No uniqueKey for msg:{}", msgExt); } if (null != uniqueKey && tr.getDeleteList() != null && tr.getDeleteList().size() > 0 && tr.getDeleteList().contains(uniqueKey)) { + //Normally, it cancels out with the +1 above + addMetric(msgExt, -1); doRes = true; tr.idempotentRelease(); perfCounterTicks.getCounter("dequeue_delete").flow(1);