OneSizeFitsQuorum commented on code in PR #13178:
URL: https://github.com/apache/iotdb/pull/13178#discussion_r1719725223
##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java:
##########
@@ -864,14 +869,30 @@ private RatisClient getRaftClient(RaftGroup group) throws
ClientManagerException
}
}
+ private RatisClient getConfigurationRaftClient(RaftGroup group) throws
ClientManagerException {
+ try {
+ return reconfigurationClientManager.borrowClient(group);
Review Comment:
consistent with clientManager
##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java:
##########
@@ -578,15 +597,26 @@ public void resetPeerList(ConsensusGroupId groupId,
List<Peer> peers) throws Con
@Override
public void transferLeader(ConsensusGroupId groupId, Peer newLeader) throws
ConsensusException {
// first fetch the newest information
+ logger.info("transfer consensusGroup {} leader to {}", groupId, newLeader);
final RaftGroupId raftGroupId =
Utils.fromConsensusGroupIdToRaftGroupId(groupId);
final RaftGroup raftGroup =
Optional.ofNullable(getGroupInfo(raftGroupId))
.orElseThrow(() -> new ConsensusGroupNotExistException(groupId));
-
+ if (raftGroup.getPeers() == null) {
Review Comment:
remove it
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/RegionMaintainHandler.java:
##########
@@ -665,18 +665,26 @@ public void removeDataNodePersistence(TDataNodeLocation
dataNodeLocation) {
* @param regionId The region to be migrated
* @param originalDataNode The DataNode where the region locates
*/
- public void transferRegionLeader(TConsensusGroupId regionId,
TDataNodeLocation originalDataNode)
+ public void transferRegionLeader(
+ TConsensusGroupId regionId, TDataNodeLocation originalDataNode,
TDataNodeLocation coodinator)
throws ProcedureException, InterruptedException {
// find new leader
final int findNewLeaderTimeLimitSecond = 10;
long startTime = System.nanoTime();
Optional<TDataNodeLocation> newLeaderNode = Optional.empty();
+ List<TDataNodeLocation> excludeDataNode = new ArrayList<>();
+ excludeDataNode.add(originalDataNode);
+ excludeDataNode.add(coodinator);
while (System.nanoTime() - startTime <
TimeUnit.SECONDS.toNanos(findNewLeaderTimeLimitSecond)) {
- newLeaderNode = filterDataNodeWithOtherRegionReplica(regionId,
originalDataNode);
+ newLeaderNode = filterDataNodeWithOtherRegionReplica(regionId,
excludeDataNode);
Review Comment:
cause redundant sleep when replica is 1?
--
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]