confluentinc / kafka-connect-jdbc

Kafka Connect connector for JDBC-compatible databases
Other
20 stars 957 forks source link

Kafka Connect JDBC Source running even when query fails #1089

Open m-kay opened 3 years ago

m-kay commented 3 years ago

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.

cyberjso commented 3 years ago

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

helkmut commented 3 years ago

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

m-kay commented 3 years ago

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.

mukeshus commented 2 years ago

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?

m-kay commented 2 years ago

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

mukeshus commented 2 years ago

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

atrbgithub commented 2 years ago

Also see:

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