DBZ-1218 Close JDBC connection in SnapshotReader for MySQL Connector

This commit is contained in:
Joy Gao 2019-04-05 23:06:10 -07:00 committed by Gunnar Morling
parent 7c0ae3ee20
commit 08271ab444

View File

@ -720,6 +720,14 @@ protected void execute() {
} }
failed(e, "Aborting snapshot due to error when last running '" + sql.get() + "': " + e.getMessage()); failed(e, "Aborting snapshot due to error when last running '" + sql.get() + "': " + e.getMessage());
} }
finally {
try {
mysql.close();
}
catch (SQLException e) {
logger.warn("Failed to close the connection properly", e);
}
}
} }
protected void readBinlogPosition(int step, SourceInfo source, JdbcConnection mysql, AtomicReference<String> sql) throws SQLException { protected void readBinlogPosition(int step, SourceInfo source, JdbcConnection mysql, AtomicReference<String> sql) throws SQLException {