You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by ji...@apache.org on 2023/05/10 08:23:36 UTC
[rocketmq] branch develop updated: [ISSUE #6722] Bugfix timer thread has error when timer not enable (#6723)
This is an automated email from the ASF dual-hosted git repository.
jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 6b6fb1722 [ISSUE #6722] Bugfix timer thread has error when timer not enable (#6723)
6b6fb1722 is described below
commit 6b6fb172248981e62a25abaac3e02b29547643a8
Author: schopenhauerz <sc...@gmail.com>
AuthorDate: Wed May 10 16:23:12 2023 +0800
[ISSUE #6722] Bugfix timer thread has error when timer not enable (#6723)
* bugfix broker boot succes but get fail ip addr
bug:
broker ip addr(IPV4) get fail after broker start up;
fix:
add compare ,continue when ip is start with '0.' ;
like :
The broker[broker-a, 0.0.1.1:10911] boot success. serializeType=JSON and name server is 127.0.0.1:9876;
* add timerstore nil condition when timer no enable
add timerstore nil condition when timer no enable
* close timer schedule thread when timer no enable
close timer schedule thread when timer no enable
* format code
format code
---
.../java/org/apache/rocketmq/broker/BrokerController.java | 5 ++++-
.../org/apache/rocketmq/broker/slave/SlaveSynchronize.java | 12 +++++++-----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java b/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
index fc76e67b6..22c403eaf 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
@@ -646,8 +646,11 @@ public class BrokerController {
BrokerController.this.getSlaveSynchronize().syncAll();
lastSyncTimeMs = System.currentTimeMillis();
}
+
//timer checkpoint, latency-sensitive, so sync it more frequently
- BrokerController.this.getSlaveSynchronize().syncTimerCheckPoint();
+ if (messageStoreConfig.isTimerWheelEnable()) {
+ BrokerController.this.getSlaveSynchronize().syncTimerCheckPoint();
+ }
} catch (Throwable e) {
LOG.error("Failed to sync all config for slave.", e);
}
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java b/broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java
index 8cbdc2555..b9de5173b 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java
@@ -215,13 +215,15 @@ public class SlaveSynchronize {
String masterAddrBak = this.masterAddr;
if (masterAddrBak != null) {
try {
- TimerCheckpoint checkpoint = this.brokerController.getBrokerOuterAPI().getTimerCheckPoint(masterAddrBak);
- if (null != this.brokerController.getTimerCheckpoint()) {
- this.brokerController.getTimerCheckpoint().setLastReadTimeMs(checkpoint.getLastReadTimeMs());
- this.brokerController.getTimerCheckpoint().setMasterTimerQueueOffset(checkpoint.getMasterTimerQueueOffset());
+ if (null != brokerController.getMessageStore().getTimerMessageStore()) {
+ TimerCheckpoint checkpoint = this.brokerController.getBrokerOuterAPI().getTimerCheckPoint(masterAddrBak);
+ if (null != this.brokerController.getTimerCheckpoint()) {
+ this.brokerController.getTimerCheckpoint().setLastReadTimeMs(checkpoint.getLastReadTimeMs());
+ this.brokerController.getTimerCheckpoint().setMasterTimerQueueOffset(checkpoint.getMasterTimerQueueOffset());
+ }
}
} catch (Exception e) {
- LOGGER.error("SyncSubscriptionGroup Exception, {}", masterAddrBak, e);
+ LOGGER.error("syncTimerCheckPoint Exception, {}", masterAddrBak, e);
}
}
}