SzyWilliam commented on code in PR #7115:
URL: https://github.com/apache/iotdb/pull/7115#discussion_r954800627
##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/NodeManager.java:
##########
@@ -432,14 +433,18 @@ public void startHeartbeatService() {
/** loop body of the heartbeat thread */
private void heartbeatLoopBody() {
- if (getConsensusManager().isLeader()) {
- // Generate HeartbeatReq
- THeartbeatReq heartbeatReq = genHeartbeatReq();
- // Send heartbeat requests to all the registered DataNodes
- pingRegisteredDataNodes(heartbeatReq, getRegisteredDataNodes());
- // Send heartbeat requests to all the registered ConfigNodes
- pingRegisteredConfigNodes(heartbeatReq, getRegisteredConfigNodes());
- }
+ Optional.ofNullable(getConsensusManager())
+ .ifPresent(
Review Comment:
Done
##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/PartitionManager.java:
##########
@@ -496,19 +497,23 @@ public String getRegionStorageGroup(TConsensusGroupId
regionId) {
/** Called by {@link PartitionManager#regionCleaner} Delete RegionGroups
periodically. */
public void clearDeletedRegions() {
- if (getConsensusManager().isLeader()) {
- final Set<TRegionReplicaSet> deletedRegionSet =
partitionInfo.getDeletedRegionSet();
- if (!deletedRegionSet.isEmpty()) {
- LOGGER.info(
- "DELETE REGIONS {} START",
- deletedRegionSet.stream()
- .map(TRegionReplicaSet::getRegionId)
- .collect(Collectors.toList()));
- deletedRegionSet.forEach(
- regionReplicaSet ->
removeRegionGroupCache(regionReplicaSet.regionId));
- SyncDataNodeClientPool.getInstance().deleteRegions(deletedRegionSet);
- }
- }
+ Optional.ofNullable(getConsensusManager())
+ .ifPresent(
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]