liyuheng55555 commented on code in PR #12165:
URL: https://github.com/apache/iotdb/pull/12165#discussion_r1533699684
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/RegionMigrateService.java:
##########
@@ -139,6 +168,34 @@ public synchronized boolean
submitDeleteOldRegionPeerTask(TMaintainPeerReq req)
return submitSucceed;
}
+ public synchronized TSStatus resetPeerList(TResetPeerListReq req) {
+ List<Peer> correctPeers =
+ req.getCorrectLocations().stream()
+ .map(location -> Peer.valueOf(req.getRegionId(), location))
+ .collect(Collectors.toList());
+ ConsensusGroupId regionId =
+
ConsensusGroupId.Factory.createFromTConsensusGroupId(req.getRegionId());
+ try {
+ if (regionId instanceof DataRegionId) {
+ DataRegionConsensusImpl.getInstance().resetPeerList(regionId,
correctPeers);
+ } else {
+ SchemaRegionConsensusImpl.getInstance().resetPeerList(regionId,
correctPeers);
+ }
+ } catch (ConsensusException e) {
+ LOGGER.error("reset peer list fail", e);
+ return new
TSStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode());
+ }
+ return new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
+ }
+
+ private boolean addToTaskResultMap(long taskId) {
Review Comment:
use putIfAbsent
--
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]