Repository navigation
fix(broker): map storage errors for ListOffsets and older Produce and Fetch versions - #273
Merged
PaxMachinaOne merged 3 commits intoOct 30, 2026
Conversation
Produce and Fetch returned UNKNOWN_SERVER_ERROR when S3 was unavailable, when an S3 write or read failed, and when a partition could not be restored from S3. librdkafka treats that as permanent and drops the message. They now return KAFKA_STORAGE_ERROR (56), keep REQUEST_TIMED_OUT for degraded S3, and set a clear error message on Produce v8 and later. Fixes KafScale#255
… Fetch versions An earliest ListOffsets lookup that cannot load a partition from S3 returned UNKNOWN_SERVER_ERROR. It now returns KAFKA_STORAGE_ERROR, as Kafka does. Produce below v4 and Fetch v5 or below predate KAFKA_STORAGE_ERROR, so they now receive NOT_LEADER_OR_FOLLOWER, matching Kafka's maybeDownConvertStorageError for Fetch. Produce append errors that do not come from S3 keep UNKNOWN_SERVER_ERROR. Refs KafScale#255
PaxMachinaOne
approved these changes
Oct 30, 2026
PaxMachinaOne
left a comment
Collaborator
There was a problem hiding this comment.
🤖 PaxMachina automated review (worker-code)
The version-aware error mapping and object-storage error classification match Kafka behavior and are adequately tested.
No blocking findings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #272 from QA review. #272 was merged before these changes, so they come as a new PR from the same branch.
Changes
UNKNOWN_SERVER_ERROR. It now returnsKAFKA_STORAGE_ERROR(56) on every version, as Kafka 3.9.1 does inhandleListOffsetRequestV1AndAboveandhandleListOffsetRequestV0, whereKafkaStorageExceptionmaps throughErrors.forExceptionwith no version check.NOT_LEADER_OR_FOLLOWER(6) instead of 56.ProduceRequest.jsonandProduceResponse.jsonsay version 4 addedKAFKA_STORAGE_ERROR.maybeDownConvertStorageErrorin Kafka 3.9.1KafkaApis(versionId <= 5).FetchResponse.jsonsays version 6 may returnKAFKA_STORAGE_ERROR.UNKNOWN_SERVER_ERRORwith no message.pkg/storagenow wraps S3 upload and cleanup failures instorage.ErrObjectStorage, and the broker uses the same error for restore failures.docs/protocol.md,docs/architecture.mdand the release note.Tests
TestStorageErrorDownConvertsForOldVersions: Produce v0 and v3 get 6, v4 and v9 get 56. Fetch v4 and v5 get 6, v6 and v11 get 56.TestListOffsetsEarliestStorageFailure: v0, v1 and v4 get 56.TestProduceAppendNonStorageErrorStaysUnknown: a canceled append gets -1 with no message.TestPartitionLogFlushErrorPreservesBuffernow checks that a failed upload wrapsstorage.ErrObjectStorage.The new broker tests fail against main and pass with the change.
Refs #255