OneSizeFitsQuorum commented on code in PR #13194:
URL: https://github.com/apache/iotdb/pull/13194#discussion_r1728722520
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNode.java:
##########
@@ -242,6 +254,57 @@ protected void doAddNode() {
}
}
+ @Override
+ protected void remove(Long nodeId) throws IoTDBException {
+ // If the nodeId was null, this is a shorthand for removing the current
dataNode.
+ // In this case we need to find our nodeId.
+ if (nodeId == null) {
+ nodeId = (long) config.getDataNodeId();
+ }
+
+ logger.info("Starting to remove DataNode with node-id {} from cluster",
nodeId);
+
+ // Load ConfigNodeList from system.properties file
+ ConfigNodeInfo.getInstance().loadConfigNodeList();
+
+ int removeNodeId = nodeId.intValue();
+ try (ConfigNodeClient configNodeClient =
+
ConfigNodeClientManager.getInstance().borrowClient(ConfigNodeInfo.CONFIG_REGION_ID))
{
+ // Find a datanode location with the given node id.
+ Optional<TDataNodeLocation> dataNodeLocationOpt =
+ configNodeClient
+ .getDataNodeConfiguration(-1)
+ .getDataNodeConfigurationMap()
+ .values()
+ .stream()
+ .map(TDataNodeConfiguration::getLocation)
+ .filter(location -> location.getDataNodeId() == removeNodeId)
+ .findFirst();
+ if (!dataNodeLocationOpt.isPresent()) {
+ throw new IoTDBException("Invalid node-id", -1);
+ }
+ TDataNodeLocation dataNodeLocation = dataNodeLocationOpt.get();
+
+ //
Review Comment:
remove this?
--
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]