CRZbulabula commented on code in PR #12116:
URL: https://github.com/apache/iotdb/pull/12116#discussion_r1514256772
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java:
##########
@@ -127,10 +133,16 @@ public RouteBalancer(IManager configManager) {
public synchronized Map<TConsensusGroupId, Pair<Integer, Integer>>
balanceRegionLeader() {
Map<TConsensusGroupId, Pair<Integer, Integer>> differentRegionLeaderMap =
new ConcurrentHashMap<>();
- if (IS_ENABLE_AUTO_LEADER_BALANCE_FOR_SCHEMA_REGION) {
+ if (IS_ENABLE_AUTO_LEADER_BALANCE_FOR_SCHEMA_REGION
+ &&
(!ConsensusFactory.RATIS_CONSENSUS.equals(SCHEMA_REGION_CONSENSUS_PROTOCOL_CLASS)
+ || System.currentTimeMillis() -
lastFailedTimeForBalanceRatisSchemaLeader
+ > BALANCE_RATIS_LEADER_FAILED_INTERVAL)) {
differentRegionLeaderMap.putAll(balanceRegionLeader(TConsensusGroupType.SchemaRegion));
}
- if (IS_ENABLE_AUTO_LEADER_BALANCE_FOR_DATA_REGION) {
+ if (IS_ENABLE_AUTO_LEADER_BALANCE_FOR_DATA_REGION
+ &&
(!ConsensusFactory.RATIS_CONSENSUS.equals(DATA_REGION_CONSENSUS_PROTOCOL_CLASS)
+ || System.currentTimeMillis() -
lastFailedTimeForBalanceRatisDataLeader
+ > BALANCE_RATIS_LEADER_FAILED_INTERVAL)) {
Review Comment:
It's impossible to simplify those `if`, since the target of this PR is to
distinguish the Ratis and IoT consensus protocol QAQ
--
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]