laughingman7743 commented on code in PR #200:
URL: 
https://github.com/apache/flink-connector-jdbc/pull/200#discussion_r3460276724


##########
flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/reader/JdbcSourceSplitReaderTest.java:
##########
@@ -144,4 +146,120 @@ void testFetch() throws Exception {
         assertThat(fetchedRecordsWithSplitIds.nextSplit()).isNull();
         splitReader.close();
     }
+
+    @Test
+    void testFetchReconnectsWhenConnectionClosedWhileOpeningSplit() throws 
Exception {
+        // The provider hands back an already-closed connection the first 
time, so the reader's
+        // first use of it fails (mimicking the connection being torn down, 
e.g. on source
+        // cancellation, before the reader finishes opening the split). The 
reader must
+        // re-establish the connection and read the whole split.
+        CountingConnectionProvider provider = new 
CountingConnectionProvider(connectionProvider, 1);
+        JdbcSourceSplitReader<TestEntry> splitReader = newReader(provider, 
split);
+        try {

Review Comment:
   Good catch, thanks! Switched the three new tests to try-with-resources and 
dropped the explicit close().



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