Skip to content

Commit 4aa6cdd

Browse files
RongtongJinRongtongJin
andauthored
[ISSUE #10019] Revert "[ISSUE #8127]Optimize the metric calculation logic of the time wheel" (#10020)
* Revert "[ISSUE #8127]Optimize the metric calculation logic of the time wheel" * Revert "[ISSUE #8127]Optimize the metric calculation logic of the time wheel" * Revert "[ISSUE #8127]Optimize the metric calculation logic of the time wheel" --------- Co-authored-by: RongtongJin <user@example.com>
1 parent 94ba5e1 commit 4aa6cdd

1 file changed

Lines changed: 5 additions & 21 deletions

File tree

store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,9 +1699,6 @@ public String getServiceName() {
16991699
public void run() {
17001700
setState(AbstractStateService.START);
17011701
TimerMessageStore.LOGGER.info(this.getServiceName() + " service start");
1702-
//Mark different rounds
1703-
boolean isRound = true;
1704-
Map<String, MessageExt> avoidDeleteLose = new HashMap<>();
17051702
while (!this.isStopped()) {
17061703
try {
17071704
setState(AbstractStateService.WAITING);
@@ -1718,18 +1715,9 @@ public void run() {
17181715
MessageExt msgExt = getMessageByCommitOffset(tr.getOffsetPy(), tr.getSizePy());
17191716
if (null != msgExt) {
17201717
if (needDelete(tr.getMagic()) && !needRoll(tr.getMagic())) {
1721-
//Clearing is performed once in each round.
1722-
//The deletion message is received first and the common message is received once
1723-
if (!isRound) {
1724-
isRound = true;
1725-
for (MessageExt messageExt : avoidDeleteLose.values()) {
1726-
addMetric(messageExt, 1);
1727-
}
1728-
avoidDeleteLose.clear();
1729-
}
17301718
if (msgExt.getProperty(MessageConst.PROPERTY_TIMER_DEL_UNIQKEY) != null && tr.getDeleteList() != null) {
1731-
1732-
avoidDeleteLose.put(msgExt.getProperty(MessageConst.PROPERTY_TIMER_DEL_UNIQKEY), msgExt);
1719+
//Execute metric plus one for messages that fail to be deleted
1720+
addMetric(msgExt, 1);
17331721
tr.getDeleteList().add(msgExt.getProperty(MessageConst.PROPERTY_TIMER_DEL_UNIQKEY));
17341722
}
17351723
tr.idempotentRelease();
@@ -1739,13 +1727,9 @@ public void run() {
17391727
if (null == uniqueKey) {
17401728
LOGGER.warn("No uniqueKey for msg:{}", msgExt);
17411729
}
1742-
//Mark ready for next round
1743-
if (isRound) {
1744-
isRound = false;
1745-
}
1746-
if (null != uniqueKey && tr.getDeleteList() != null && tr.getDeleteList().size() > 0
1747-
&& tr.getDeleteList().contains(buildDeleteKey(getRealTopic(msgExt), uniqueKey, storeConfig.isAppendTopicForTimerDeleteKey()))) {
1748-
avoidDeleteLose.remove(uniqueKey);
1730+
if (null != uniqueKey && tr.getDeleteList() != null && tr.getDeleteList().size() > 0 && tr.getDeleteList().contains(buildDeleteKey(getRealTopic(msgExt), uniqueKey, storeConfig.isAppendTopicForTimerDeleteKey()))) {
1731+
//Normally, it cancels out with the +1 above
1732+
addMetric(msgExt, -1);
17491733
doRes = true;
17501734
tr.idempotentRelease();
17511735
perfCounterTicks.getCounter("dequeue_delete").flow(1);

0 commit comments

Comments
 (0)