kafka-connect-jdbc icon indicating copy to clipboard operation
kafka-connect-jdbc copied to clipboard

Kafka Connect JDBC Source running even when query fails

Open m-kay opened this issue 3 years ago • 7 comments

I'm running a JDBC source connector and try to monitor its status somehow via the exposed JMX metrics and a prometheus exporter. However the status of the connector and all its tasks are still in the running state when the query fails or db can't be reached.

In earlier versions it seems that no value for source-record-poll-total in the source-task-metrics was exported when the query failed and this could be used to detect such a failure. In the versions I use (connect-runtime-6.2.0-ccs, confluentinc-kafka-connect-jdbc-10.2.0, jmx_prometheus_javaagent-0.14.0) even when the query is failing the metric is exported with value 0.0 so there is no chance to detect when something is wrong with the database.

m-kay avatar Jul 01 '21 07:07 m-kay

I'm experiencing the same issue. That makes error go unnoticed even when monitoring available metrics.

cyberjso avatar Jul 26 '21 16:07 cyberjso

Same issue here! The connector status is wrong when SQL query fail!

helkmut avatar Jul 26 '21 16:07 helkmut

With version 10.2.4 the task now fails on SQLNonTransientException (see #1096), which resolves my issue since a failing task can be detected via the exported metrics.

m-kay avatar Oct 18 '21 11:10 m-kay

Can you please explain about the setting that we need to make in the connector config to make the it fail in case of a SQL exception?

mukeshus avatar Jul 13 '22 09:07 mukeshus

With version 10.2.4 and later you don't need to configure anything. The connector is stopping when SQL exceptions are thrown.

m-kay avatar Jul 14 '22 12:07 m-kay

I don't see it is failing. Attaching a connector config where I passed an unknown table that really don't exist in the DB. But the connector is still running even though there is a SQL exception. My jdbc connector version is 10.5.1 . Any comments?

image image

mukeshus avatar Jul 14 '22 14:07 mukeshus

Also see:

https://github.com/confluentinc/kafka-connect-jdbc/issues/973 https://github.com/confluentinc/kafka-connect-jdbc/issues/892

atrbgithub avatar Sep 08 '22 07:09 atrbgithub