From 8bf70a4d036e1b6fa9fb9478f2e2d6f5c5acc2b2 Mon Sep 17 00:00:00 2001 From: wanghuaiyuan Date: Tue, 21 Jan 2025 08:03:38 +0800 Subject: [PATCH] fix fail test --- .../org/apache/rocketmq/store/config/MessageStoreConfig.java | 4 ++++ .../store/timer/rocksdb/TimerMessageRocksDBStoreTest.java | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java b/store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java index a6d15cdd61f..b67735c4a4d 100644 --- a/store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java +++ b/store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java @@ -1725,6 +1725,10 @@ public boolean isTimerStopDequeue() { return timerStopDequeue; } + public void setTimerStopDequeue(boolean timerStopDequeue) { + this.timerStopDequeue = timerStopDequeue; + } + public int getTimerMetricSmallThreshold() { return timerMetricSmallThreshold; } diff --git a/store/src/test/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStoreTest.java b/store/src/test/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStoreTest.java index fb973b9c35a..07c7424f344 100644 --- a/store/src/test/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStoreTest.java +++ b/store/src/test/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStoreTest.java @@ -187,6 +187,8 @@ public void testDoNormalTimer() throws Exception { long commitOffset = timerMessageStore.getCommitOffset(); long curr = System.currentTimeMillis() / precisionMs * precisionMs; long delayMs = curr + 3000; + storeConfig.setTimerStopDequeue(true); + for (int i = 0; i < 10; i++) { for (int j = 0; j < 5; j++) { MessageExtBrokerInner inner = buildMessage((i % 2 == 0) ? 3000 : delayMs, topic + i, i % 2 == 0); @@ -207,7 +209,7 @@ public Boolean call() { for (int i = 0; i < 10; i++) { Assert.assertEquals(5, timerMessageStore.getTimerMetrics().getTimingCount(topic + i)); } - + storeConfig.setTimerStopDequeue(false); for (int i = 0; i < 10; i++) { for (int j = 0; j < 5; j++) { ByteBuffer msgBuff = getOneMessage(topic + i, 0, j, 4000);