Caideyipi commented on code in PR #13593:
URL: https://github.com/apache/iotdb/pull/13593#discussion_r1778061442


##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/protocol/IoTDBConnector.java:
##########
@@ -175,6 +203,100 @@ public void validate(final PipeParameterValidator 
validator) throws Exception {
             Arrays.asList(CONNECTOR_IOTDB_BATCH_SIZE_KEY, 
SINK_IOTDB_BATCH_SIZE_KEY),
             CONNECTOR_IOTDB_PLAIN_BATCH_SIZE_DEFAULT_VALUE));
 
+    this.customSendPortStrategy =
+        parameters
+            .getStringOrDefault(
+                Arrays.asList(
+                    CONNECTOR_IOTDB_SEND_PORT_RESTRICTION_STRATEGY_KEY,
+                    SINK_IOTDB_SEND_PORT_RESTRICTION_STRATEGY_KEY),
+                CONNECTOR_IOTDB_SEND_PORT_RESTRICTION_RANGE_STRATEGY)
+            .trim()
+            .toLowerCase();
+
+    validator.validate(
+        arg -> 
CONNECTOR_IOTDB_SEND_PORT_RESTRICTION_STRATEGY_SET.contains(customSendPortStrategy),
+        String.format(
+            "send port restriction strategy should be one of %s, but got %s.",
+            CONNECTOR_IOTDB_SEND_PORT_RESTRICTION_STRATEGY_SET, 
customSendPortStrategy),
+        customSendPortStrategy);
+
+    final int parallelTaskNum =
+        parameters.getIntOrDefault(
+            Arrays.asList(
+                PipeConnectorConstant.CONNECTOR_IOTDB_PARALLEL_TASKS_KEY,
+                PipeConnectorConstant.SINK_IOTDB_PARALLEL_TASKS_KEY),
+            
PipeConnectorConstant.CONNECTOR_IOTDB_PARALLEL_TASKS_DEFAULT_VALUE);
+    final int requiredPortsNum =
+        parallelTaskNum
+            * 
CommonDescriptor.getInstance().getConfig().getPipeAsyncConnectorMaxClientNumber();

Review Comment:
   The required ports num may be "parallelTaskNum * receiverNodeNum" for air 
gap and sync connector, and "getPipeAsyncConnectorMaxClientNumber() * 
receiverNodeNum" for async connector. And you should consider schema region 
connector, which may need "receiverNodeNum" ports.... And there are multiple 
regions... Can we simply delete this check?



-- 
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: reviews-unsubscr...@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to