davsclaus opened a new pull request, #30661:
URL: https://github.com/apache/camel/pull/30661

   [CAMEL-27448](https://issues.apache.org/jira/browse/CAMEL-27448)
   
   When the Debezium engine failed to start (MySQL with 
`binlog_format=STATEMENT`, a lost schema history, a database that cannot be 
reached or that refuses TLS), the route kept running and was never ready. The 
only sign of the failure was a WARN.
   
   ### Changes
   - `DebeziumConsumer.doStart` now waits until the engine calls 
`pollingStarted`, which happens once its tasks have started and before an 
initial snapshot is done, so a long snapshot does not delay the start. A 
failure during that wait fails the start of the consumer, and so of the route, 
with `Debezium engine failed to start, route: <id> (<sanitized uri>): 
<Debezium's message>` and Debezium's exception as the cause. An invalid 
configuration that makes the engine's `build()` throw fails the start the same 
way.
   - **How long the start waits:** Debezium's own limit, 
`internal.task.management.timeout.ms` (40 s by default) for each task, plus the 
same again for the connector and offset store phase, which Debezium does not 
limit. If the engine has not reported back by then, the route starts as before, 
with a WARN. The health check stays at its initial state until the engine polls.
   - **A failure after the start** goes to the consumer exception handler, as 
before (the route's error handler with `bridgeErrorHandler=true`), and turns 
the health check DOWN (CAMEL-24889, CAMEL-24919). A lock makes sure a failure 
is either thrown by the start or handed to the exception handler, never both 
and never lost.
   - Docs of the six `debezium-*` components and the 4.24 upgrade guide 
describe the new start behaviour.
   
   ### Tests
   - `DebeziumConsumerEngineFailureTest` (rewritten): a corrupted offset store 
fails `startRoute`. The message names the route and the cause, the route is not 
started, and the exception handler is not called.
   - `DebeziumConsumerEngineFailureAfterStartTest` (new): a failure while 
polling goes to the exception handler once and turns the health check DOWN. 
With `bridgeErrorHandler=true` it reaches `onException`.
   - `DebeziumConsumerStartTimeoutTest` (new): a connector that hangs in 
`start()` lets the route start after the wait limit, with the WARN. The health 
check is DOWN, and it turns UP once the connector goes on.
   - `DebeziumConsumerReadinessTest` adjusted, as `start()` now blocks until 
the tasks have started.
   - `mvn test` in common (42), db2 (4), mongodb (8), mysql (5), oracle (4), 
postgres (5) and sqlserver (5): all green.
   - Checked by hand against MySQL 8.4.7 in Docker:
     - `binlog_format=STATEMENT`, a deleted schema history, and a stopped 
database each fail the route start within about 0.5 s with Debezium's message.
     - A normal setup starts in about 0.45 s while the snapshot goes on.
   - Not covered: the SQL Server TLS case (same code path in Debezium), and 
`tasks.max > 1`.
   
   ### Questions for the review
   - The wait limit comes from Debezium's 
`internal.task.management.timeout.ms`, which is an `internal.` property, 
instead of a new `@UriParam`. A new option would mean regenerating the six 
connectors plus the endpoint DSL, the component DSL and the catalog. Is reusing 
Debezium's setting fine?
   - An engine that stops *without* an error during start still lets the route 
start, as before, and only logs at DEBUG. Should that fail the start too?
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to