Repository navigation
Conversation
|
|
||
| /// Returns the last step of the batch that is in the connector, and marks | ||
| /// the batch as failed if `failed`. | ||
| fn record_batch_error(&self, failed: bool) -> Option<Step> { |
There was a problem hiding this comment.
bug (medium): This charges any error to whichever batch is active, including errors raised on other threads. Kafka FT report_fatal (kafka_ft_fatal) and the non-FT delivery and producer callbacks run on librdkafka threads. If one of them fires while a later batch is in flight, that later batch goes into dropped_steps and its step is stamped on the error. The batch that really failed is not in the list. So the user gets a wrong answer (a false positive plus a false negative), not just a missing one. I confirmed this with a unit test in which a fatal transport_error from a spawned thread during batch_start(5..5) produced dropped_steps == [5..5], while the real failure in 2..4 was missing.
Possible fix: record the output thread's ThreadId in batch_start, and only attribute errors (both failed and step) raised on that thread.
There was a problem hiding this comment.
Thanks, confirmed. Fixed in db0a637 as you propose: batch_start records the output thread, and only an error from that thread gets the step and can mark the batch. An error from another thread has step: None. Your test is in as worker_error_during_the_next_batch_has_no_step (fails without the check: Some(5)).
| | Transactions | The output of a transaction leaves at its commit. If the connector drops that output, the range has all the steps of the transaction. | | ||
| | Output buffer | If the connector drops a flush of its output buffer, the range has all the steps since the previous flush. | | ||
| | Initial snapshot | If the connector drops its initial snapshot, the range starts at step 0, because a snapshot has the output of all earlier input. | | ||
| | The connector reports the failure after the batch ended | The steps are not in the list. The Kafka output connectors can report a delivery failure in this way. | |
There was a problem hiding this comment.
bug (medium, docs): This row is not accurate today. A late Kafka failure is not simply left out. If another batch is in flight when the failure arrives, its steps are put in the list instead, and the error gets that batch's step (see the comment on record_batch_error). Either fix the code or say here that the range and the step can belong to an unrelated batch.
There was a problem hiding this comment.
Fixed in db0a637 with the code change: the row now says that a failure reported later or from a thread of the connector is not in the list and has no step.
|
What I ran
I also checked the step numbering. The token Gates: tests, docs, changelog and the additive API change are all fine. No bug (medium): errors raised on other threads (Kafka) are charged to the batch in flight. See the inline comments. This is the QA test I used, which passes and so confirms the wrong attribution: + #[test]
+ fn async_error_is_charged_to_the_batch_in_flight() {
+ // ... endpoint = Arc::new(OutputEndpointStatus::new(...))
+ endpoint.batch_start(range(2, 4));
+ endpoint.batch_end();
+ endpoint.batch_start(range(5, 5));
+ let e = endpoint.clone();
+ std::thread::spawn(move || {
+ e.transport_error(true, Some("kafka_ft_fatal"), &anyhow!("delivery failed"))
+ }).join().unwrap();
+ endpoint.batch_end();
+ let status = endpoint.to_api_type(true);
+ assert_eq!(status.dropped_steps, [range(5, 5)]); // wrong batch
+ assert_eq!(status.transport_errors.unwrap()[0].step, Some(5));
+ }missing (medium), test cases the PR does not cover:
|
|
Thanks. In db0a637: the thread fix (see the inline replies), and the three cases you listed:
The two controller cases fail when the range of a batch is its last step only. 5 of 5 runs pass. |
When an output connector drops output, a user could not find which input that output came from. A completion token is complete also when a connector dropped the output of its input, which is intended. The status of the connector had the error text and the counters, and nothing that links a dropped batch to a token. The output thread knows the steps of each batch that it gives to a connector. Record them: - The status of an output endpoint has a new list, dropped_steps: the ranges of steps whose output the connector did not write completely. A batch counts as dropped when the endpoint reports an encode error or a fatal transport error between its batch_start and the return of its batch_end. The list merges ranges that touch, keeps 100 ranges, and covers the current run: a token is not valid after a restart. - Each error that an output endpoint reports during a batch has the last step of that batch. The steps use the numbers of the step of a completion token. The range of a batch starts after the last step that the endpoint reported as processed, so it has the steps of a transaction when the batch is its commit, and the steps since the last flush for an output buffer. The range of a snapshot starts at step 0, because a snapshot has the output of all earlier input. A connector that reports a delivery failure after batch_end returned, as the Kafka connectors can, is not covered. The docs of completion tokens tell how to compare the step of a token with the ranges, and give the limits. The Python SDK, the OpenAPI schema and the web console types have the new fields. The status merge of a multihost pipeline takes the union of the ranges. Fixes: #8097 Signed-off-by: Xavier Bestel <xavier.bestel@feldera.com>
The status of an output endpoint charged each error to the batch that was in the connector. A connector that reports a failure from a thread of its own (the Kafka delivery and producer callbacks) while a later batch is in the connector put that later batch in dropped_steps and gave the error its step, and the batch that failed was not there. Record the thread that gives the batch to the connector. Only an error from that thread gets the step of the batch and can mark it as dropped. An error from another thread has no step. The Postgres output connector reports some errors from its worker threads, and reports a dropped batch as pg_batch_end from batch_end, on the output thread, so its dropped batches stay in the list. Add tests: an error from another thread during a later batch, a dropped flush of the output buffer, and a dropped initial snapshot. Signed-off-by: Xavier Bestel <xavier.bestel@feldera.com>
…ost order - A connector that returns an error from a write (push_buffer, push_key or batch_end), as Redis does when it loses the updates of a batch, reports it with fatal=false. Such a batch now goes into dropped_steps too. The rule for errors from connector callbacks does not change. - The empty-buffer path of the output thread settled the range on the counts of the buffer also for an entry with no counts. For a new buffered sink these are 0, so its next failed flush got a range from step 1. Settle only on an entry with counts. - The multihost merge applied the limit of 100 ranges at each merge of two hosts, so the result depended on the order of the hosts. Each host keeps its limit, and the merge now takes the full union. - Docs: how to choose the lower bound for overlapping requests on one input connector, and two more limits (rows that a connector skips, the deferred commit of distributed Delta Lake). Signed-off-by: Xavier Bestel <xavier.bestel@feldera.com>
| /// Increment error counter. If this is the first fatal error, | ||
| /// save it in `self.fatal_error`. | ||
| fn transport_error(&self, fatal: bool, tag: Option<&str>, error: &AnyError) { | ||
| let step = self.record_batch_error(fatal); |
There was a problem hiding this comment.
bug (high): fatal is used as a stand-in for "this batch was lost", but the integrated sinks report a batch they gave up as non-fatal, from batch_end on the output thread. Examples:
- Delta Lake
batch_end→give_up+output_transport_error(.., false, .., "delta_batch_end")(integrated/delta_table/output.rs:1567) - Iceberg
give_up→"iceberg_commit",false(integrated/iceberg.rs:~390) - DynamoDB: a chunk that ran out of retries,
false(integrated/dynamodb/output.rs:~885)
These are not OutputProbes, so the write_failed path does not cover them. Their dropped batches get a step on the error but never appear in dropped_steps, which is the gap that #8097 asks to close. The docs table only lists the distributed Delta Lake deferred commit and Kafka.
Suggestion: give connectors an explicit way to say "this batch was dropped", e.g. a batch_dropped(endpoint_id) on the controller, or a drops_batch flag next to fatal. Call it from each give_up path, and add a suite case with an Encoder-as-consumer sink that gives up in batch_end.
There was a problem hiding this comment.
Fixed in 02cc982. New ControllerInner::output_batch_dropped(endpoint_id) marks the batch in the connector as one that lost output, on the output thread only. Delta Lake (give_up), Iceberg (give_up) and DynamoDB (a chunk that ran out of retries) call it. A write that returns an error uses the same call. Tests: dropped_step_on_explicit_report (a sink that is its own consumer and gives up in batch_end, with and without the call), dropped_step_on_delta_commit_error, dropped_step_on_iceberg_commit_error, and the two DynamoDB cases for a permanent failure. Each fails when the call does nothing.
|
What I ran
bug (high): see the inline comment. The Delta Lake, Iceberg and DynamoDB sinks report a batch they gave up as a non-fatal callback error from missing (medium): test cases the PR does not cover
The feldera-pr-checks gates pass: tests, docs and changelog are present, the change is additive with |
…ve up The integrated sinks that are their own consumer report a batch that they gave up as a transport error that is not fatal, from batch_end on the output thread. So a batch that Delta Lake, Iceberg or DynamoDB dropped had its step on the error and was not in dropped_steps. Add ControllerInner::output_batch_dropped, which marks the batch in the connector as one that lost output. It follows the thread rule of the other reports: only a call on the output thread counts. Delta Lake, Iceberg and DynamoDB call it where they give up on a batch or on a part of it. A write that returns an error uses the same call. Postgres reports a dropped batch as fatal, so it needs no change. An error that a checkpoint restored kept its step, while dropped_steps starts empty after a restart. Clear the step when the error lists are restored. Tests: a sink in the shape of an integrated connector that gives up in batch_end, with and without the report; an encode error and a key write error in a pipeline; a commit that fails in Delta Lake (local table) and in Iceberg (mock catalog); the two DynamoDB cases for a permanent failure; the restore of an error. Each one fails when the report does nothing. Signed-off-by: Xavier Bestel <xavier.bestel@feldera.com>
|
Status of the review points, as of 02cc982:
Not covered, as before and in the docs: the deferred commit of distributed Delta Lake, and delivery failures that the Kafka sinks report from their own threads. |
swanandx
left a comment
There was a problem hiding this comment.
A batch counts as dropped only when its error is fatal (record_batch_error(fatal) in transport_error). Some connectors give up on a batch with an error that is not fatal. For example, after its last retry the Iceberg output calls output_transport_error with fatal = false for iceberg_commit. That drop is not in dropped_steps, but its error gets a step. Please count any error that the output thread reports during a batch.
Also, the limit of 100 ranges removes the oldest ranges with no marker. An old token then looks safe. If you merge the two oldest ranges, the list stays correct.
Before more work on this, I think we need agreement that this API is useful, because #8018 was closed for that reason.
Linked Issue
Fixes #8097. Follow-up of #8014, #8017 and the closed #8018.
What changes
When an output connector drops output, a user could not find which input that output came from. A completion token is
completealso for dropped output (intended, not changed). The status of the connector had the error text and the counters, and nothing that links a dropped batch to a token.The output thread knows the steps of each batch that it gives to a connector. This PR records them, as the issue proposes.
dropped_stepsin the status of an output connector{first_step, last_step}ranges (both included) of steps whose output the connector did not write completely. Ascending, ranges that touch are merged, at most 100 ranges, current run onlystepin a connector errorA client keeps the
stepthat/completion_statusreturns for the token of each request. A request with stepS, whose previous request on the same input connector has stepP, can have missing output if a range overlaps[P, S]. The docs of completion tokens have this procedure and its limits.Design decisions
batch_startand the return ofbatch_end, on the output thread: an encode error, a fatal transport error, a write that returns an error, or an explicit report of the connector (ControllerInner::output_batch_dropped). Delta Lake, Iceberg and DynamoDB make that report where they give up on a batch or on a part of itstepand marks nothing. An error that is not fatal (Postgrespg_batch_start, when the batch is written again) does not count by itselftotal_processed_stepsthat the endpoint reported, to the step of the batchstepof a completion token, no conversionKnown limits (in the docs)
batch_endreturned, or from a thread of its own, is not covered. The Kafka output connectors can do this. The deferred commit of distributed Delta Lake is not covered either.step: the list covers the current run.stepthat is read late can be too high.This PR and #8196 both add a field to
ConnectorError. The one that merges second needs a small rebase.Describe Manual Test Plan
dropped_steps_identify_the_failed_request: a real pipeline, an output endpoint that reports a fatal error for its first write. Two requests with tokensdropped_stepsand is thestepof the error; the step of the second token is in no rangedropped_stepsandstepparsed, old replies acceptedopenapi.jsonand the web console types regeneratedfeldera-types,dbsp_connectors,static-connectorsChecklist
Breaking Changes?
Describe Incompatible Changes
Additive only. New optional fields in
/statsand in the connector status. Rust code that builds aConnectorErroror anExternalOutputEndpointStatuswith a struct literal must add the new field.