confluentinc / kafka-connect-jdbc

Kafka Connect connector for JDBC-compatible databases
Other
1.01k stars 954 forks source link

Revert "Allow close() on CachedConnectionProvider while attempting to connect…" #1272

Closed mukkachaitanya closed 1 year ago

mukkachaitanya commented 1 year ago

What?

Reverts confluentinc/kafka-connect-jdbc#1206

Why?

We missed a big part of the fact that the internal retries of the ConnectionProvider also call on close.

For example, JdbcDbWriter#closeQuitely is called during internal retries JdbcSinkTask#put. This can cause NPEs as we return a null connection back when a new connection is requested since we have set isRunning to false.

This regression wasn't caught by 5.0.x tests. It failed further down on the pint merge on newer branches.