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


##########
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:
   Yes, I also found this problem. There will be a synchronous connector under 
each asynchronous connector. If the synchronous connector is used, it will also 
be different. This judgment is very necessary, otherwise unexpected errors will 
occur during the use of Pipe.



-- 
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]

Reply via email to