wuchong commented on a change in pull request #14387:
URL: https://github.com/apache/flink/pull/14387#discussion_r546490728



##########
File path: 
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/table/JdbcDynamicTableFactory.java
##########
@@ -322,6 +329,13 @@ private void validateConfigOptions(ReadableConfig config) {
                                SINK_MAX_RETRIES.key(),
                                config.get(SINK_MAX_RETRIES)));
                }
+
+               if (config.get(MAX_RETRY_TIMEOUT).getSeconds() <= 0) {
+                       throw new IllegalArgumentException(String.format(
+                               "The value of '%s' option should be positive, 
but is %ss.",
+                               MAX_RETRY_TIMEOUT.key(),
+                               config.get(MAX_RETRY_TIMEOUT).getSeconds()));
+               }

Review comment:
       ```suggestion
                        throw new IllegalArgumentException(String.format(
                                "The value of '%s' option must be in second 
granularity and larger than 1 second, but is %s.",
                                MAX_RETRY_TIMEOUT.key(),
                                
config.get(ConfigOptions.key(MAX_RETRY_TIMEOUT.key()).stringType().noDefaultValue())));
   ```

##########
File path: 
flink-connectors/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcDynamicTableFactoryTest.java
##########
@@ -306,6 +308,18 @@ public void testJdbcValidation() {
                                "The value of 'sink.max-retries' option 
shouldn't be negative, but is -1.")
                                .isPresent());
                }
+
+               // connection.max-retry-timeout should be positive
+               try {
+                       Map<String, String> properties = getAllOptions();
+                       properties.put("connection.max-retry-timeout", "0s");

Review comment:
       Would be better to verify `100ms` here .

##########
File path: 
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/table/JdbcDynamicTableFactory.java
##########
@@ -322,6 +329,13 @@ private void validateConfigOptions(ReadableConfig config) {
                                SINK_MAX_RETRIES.key(),
                                config.get(SINK_MAX_RETRIES)));
                }
+
+               if (config.get(MAX_RETRY_TIMEOUT).getSeconds() <= 0) {
+                       throw new IllegalArgumentException(String.format(
+                               "The value of '%s' option should be positive, 
but is %ss.",
+                               MAX_RETRY_TIMEOUT.key(),
+                               config.get(MAX_RETRY_TIMEOUT).getSeconds()));
+               }

Review comment:
       We only supports seconds granularity and should larger than 1s. 




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

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


Reply via email to