Skip to content

Commit

Permalink
[postgres] close replication connection when close incremental Source…
Browse files Browse the repository at this point in the history
…SplitReader(apache#2425)
  • Loading branch information
loserwang1024 committed Aug 23, 2023
1 parent 7adb037 commit 6ec5705
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,11 @@ public Offset getStreamOffset(SourceRecord sourceRecord) {
}

@Override
public void close() {
public void close() throws Exception {
ReplicationConnection replicationCon = replicationConnection.get();
if (replicationCon != null) {
replicationCon.close();
}
jdbcConnection.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.nio.file.Files;
import java.nio.file.Paths;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays;
Expand Down Expand Up @@ -155,10 +154,6 @@ public void createAndInitialize() {
}
}

public Connection getJdbcConnection() throws SQLException {
return DriverManager.getConnection(container.getJdbcUrl(), username, password);
}

private String convertSQL(final String sql) {
return sql.replace("$DBNAME$", schemaName);
}
Expand Down

0 comments on commit 6ec5705

Please sign in to comment.