Skip to content

Commit

Permalink
fix confignode restart
Browse files Browse the repository at this point in the history
Signed-off-by: OneSizeFitQuorum <tanxinyu@apache.org>
  • Loading branch information
OneSizeFitsQuorum committed May 21, 2024
1 parent 6a0a23d commit 82a00fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ public TSStatus createPeerForConsensusGroup(List<TConfigNodeLocation> configNode

for (int i = 0; i < rpcTimeoutInMS / retryIntervalInMS; i++) {
try {
if (consensusManager.get() == null) {
if (consensusManager.get() == null || !consensusManager.get().isInitialized()) {
TimeUnit.MILLISECONDS.sleep(retryIntervalInMS);
} else {
// When add non Seed-ConfigNode to the ConfigNodeGroup, the parameter should be emptyList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public class ConsensusManager {
private final IManager configManager;
private IConsensus consensusImpl;

private boolean isInitialized;

public ConsensusManager(IManager configManager, ConfigRegionStateMachine stateMachine) {
this.configManager = configManager;
setConsensusLayer(stateMachine);
Expand All @@ -101,6 +103,7 @@ public void start() throws IOException {
"Something wrong happened while calling consensus layer's createLocalPeer API.", e);
}
}
isInitialized = true;
}

public void close() throws IOException {
Expand Down Expand Up @@ -444,4 +447,8 @@ private NodeManager getNodeManager() {
public void manuallyTakeSnapshot() throws ConsensusException {
consensusImpl.triggerSnapshot(ConfigNodeInfo.CONFIG_REGION_ID, true);
}

public boolean isInitialized() {
return isInitialized;
}
}

0 comments on commit 82a00fa

Please sign in to comment.