Skip to content

Commit

Permalink
[ISSUE #6926] Fixing the error in the initialization order of replica…
Browse files Browse the repository at this point in the history
…sManager caused the controller mode to fail to start.
  • Loading branch information
RongtongJin committed Jun 23, 2023
1 parent 4e09a9c commit 82492a6
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -761,9 +761,6 @@ public boolean initializeMessageStore() {
messageStoreConfig, brokerStatsManager, messageArrivingListener, brokerConfig, configuration);
this.messageStore = MessageStoreFactory.build(context, defaultMessageStore);
this.messageStore.getDispatcherList().addFirst(new CommitLogDispatcherCalcBitMap(this.brokerConfig, this.consumerFilterManager));
if (this.brokerConfig.isEnableControllerMode()) {
this.replicasManager = new ReplicasManager(this);
}
if (messageStoreConfig.isTimerWheelEnable()) {
this.timerCheckpoint = new TimerCheckpoint(BrokerPathConfigHelper.getTimerCheckPath(messageStoreConfig.getStorePathRootDir()));
TimerMetrics timerMetrics = new TimerMetrics(BrokerPathConfigHelper.getTimerMetricsPath(messageStoreConfig.getStorePathRootDir()));
Expand All @@ -785,11 +782,6 @@ public boolean initialize() throws CloneNotSupportedException {
return false;
}

if (this.brokerConfig.isEnableControllerMode()) {
this.replicasManager.setFenced(true);
}


result = this.initializeMessageStore();
if (!result) {
return false;
Expand All @@ -802,6 +794,11 @@ public boolean recoverAndInitService() throws CloneNotSupportedException {

boolean result = true;

if (this.brokerConfig.isEnableControllerMode()) {
this.replicasManager = new ReplicasManager(this);
this.replicasManager.setFenced(true);
}

if (messageStore != null) {
registerMessageStoreHook();
result = this.messageStore.load();
Expand Down

0 comments on commit 82492a6

Please sign in to comment.