Repository navigation
storage: Halt Kafka sources on responses over receive.message.max.bytes - #41074
martykulma wants to merge 5 commits into
Conversation
815d9f3 to
43a44d6
Compare
Add a source-sink-errors scenario that writes a record whose fetch response exceeds librdkafka's default receive.message.max.bytes, and expects the source status history to show the error. librdkafka currently retries silently, so the scenario fails until the source surfaces it. Co-Authored-By: Claude <noreply@anthropic.com>
librdkafka retries a fetch whose response exceeds receive.message.max.bytes indefinitely, and the source kept reporting running. Recognize the error, keep the reader consumer's librdkafka errors, and report a halting status when it occurs, so the source shows stalled with the error and restarts. Closes: SS-549 Co-Authored-By: Claude <noreply@anthropic.com>
…record Co-Authored-By: Claude <noreply@anthropic.com>
43a44d6 to
580ae2c
Compare
QA LLM Review1. MEDIUM -- Each retry rereads the snapshot prefix before an oversized batch
If an existing topic has an oversized batch near the end of its initial snapshot, every restart fetches and processes the readable prefix again. One unchanged batch can keep the broker and storage replica replaying the same backlog until someone raises the limit. DetailsThe first timestamp binding covers the entire initial snapshot at time zero ( 2. MEDIUM -- The wedged reader can discard a detected topic deletion
On a single-worker source, deleting and recreating the topic during the restart delay can leave the table stuck without its terminal deletion error. The metadata fetcher can observe the deletion and close the remap shard while the reader is permanently parked before it can put the error into the table. DetailsThe fetcher sends both an empty upstream frontier and a 3. MEDIUM -- A failed bootstrap handshake can restart a healthy ingestion
A bootstrap endpoint that returns an HTTP error during Kafka version negotiation triggers the same halt as an oversized fetch. Even if librdkafka falls back to a healthy bootstrap broker and all partition leaders are available, the queued handshake error restarts the whole source. DetailsThe pinned librdkafka runs the Kafka response parser during 4. MEDIUM -- Broker errors accumulate without a bound while the reader is backpressured
The reader now retains every broker error in an unbounded queue. During a prolonged persist write or upsert rehydration, Kafka's background threads can continue reporting connection failures while the reader cannot drain them. Memory grows with the number of failures across all affected readers. DetailsA restored reader creates its consumer before waiting for rehydration ( |
- require messsage to contain "in state UP" to ensure error came from Kafka - bound error channel
QA LLM Review1. MEDIUM -- A full error queue can let the reader skip an oversized batch
While a reader is backpressured, 64 unrelated broker errors can fill its queue and cause it to drop every oversized-response error for an unread batch. If Kafka retention deletes that batch before the reader drains the queue, an established source can resume at a later offset and report DetailsThe reader polls librdkafka before draining the queue ( |
QA LLM Review1. MEDIUM -- Topic deletion lets a historical query return an incomplete count
With one readable record and one oversized record in a partition, wait for the progress source to report offset 2 and issue a DetailsAfter partition discovery, 2. MEDIUM -- Source status recommends raising the fetch limit after the table is permanently sealed
After topic deletion during the restart delay, querying the table reports that the source must be recreated. The source and table entries in DetailsThe normal deletion handler reports the terminal cause for the parent source ( |
Motivation
Closes: SS-549
When a broker's fetch response exceeds the reader consumer's
receive.message.max.bytes, librdkafka logs the error, drops the connection, and retries the same fetch indefinitely. The reader consumer's client context discarded librdkafka's errors. The metadata consumer kept running though, so the source reportedrunningeven though it couldn't read the data from the topic.Description
Adds a
ResponseTooLargevariant toMzKafkaErrorfor librdkafka's "increase receive.message.max.bytes" error.The Kafka source reader consumer now keeps librdkafka's errors on a channel, which the reader drains on every loop iteration. On a
ResponseTooLargeerror, the reader reports a halting status. The source shows as stalled with the error and restarts afterstorage_suspend_and_restart_delay. The restart re-creates the reader consumers, which picks up a raisedkafka_source_receive_message_max_bytes.Verification
Adds an
oversized-fetch-responsescenario totest/source-sink-errors. It writes a 100,000,000-byte record to an Apache Kafka topic and expects the source status history to show the error. It then raiseskafka_source_receive_message_max_bytesand expects the source to ingest the record and return to running. Adds a unit test for parsing the error.Release notes
This release will report a Kafka source as stalled and restart it when a broker response exceeds the size the source accepts, instead of reporting it as running while it retries indefinitely.
🤖 Generated with Claude Code
🤺 Improved by hooman