fsk119 commented on a change in pull request #12712: URL: https://github.com/apache/flink/pull/12712#discussion_r442903612
########## File path: flink-connectors/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/internal/JdbcFullTest.java ########## @@ -104,6 +107,52 @@ public void testEnrichedClassCastException() { } } + @Test + public void testJdbcBatchingOutputFormatCloseDuringRuntime() throws Exception{ + JdbcOptions options = JdbcOptions.builder() + .setDBUrl(getDbMetadata().getUrl()) + .setTableName(OUTPUT_TABLE) + .build(); + + RuntimeContext context = Mockito.mock(RuntimeContext.class); + ExecutionConfig executionConfig = Mockito.mock(ExecutionConfig.class); + JdbcExecutionOptions jdbcExecutionOptions = Mockito.mock(JdbcExecutionOptions.class); + JdbcBatchStatementExecutor executor = Mockito.mock(JdbcBatchStatementExecutor.class); + + doReturn(executionConfig).when(context).getExecutionConfig(); + // use scheduledThreadPool + doReturn(500L).when(jdbcExecutionOptions).getBatchIntervalMs(); + doReturn(2).when(jdbcExecutionOptions).getBatchSize(); + doReturn(3).when(jdbcExecutionOptions).getMaxRetries(); Review comment: If we want to use scheduler in batchingOutputFormat, we have to set the batchsize larger than 1. So I think we setting batsize 2 is better. ---------------------------------------------------------------- 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