Skip to content

fix(broker): return a retriable storage error when S3 is unavailable - #272

Merged
PaxMachinaOne merged 1 commit into
KafScale:mainfrom
novatechflow:fix/255-retriable-s3-error
Oct 30, 2026
Merged

PaxMachinaOne merged 1 commit into
KafScale:mainfrom
novatechflow:fix/255-retriable-s3-error

Conversation

@novatechflow

Copy link
Copy Markdown
Collaborator

Summary

Produce and Fetch now return a retriable KAFKA_STORAGE_ERROR (56) instead of UNKNOWN_SERVER_ERROR (-1) when S3 is unavailable or an S3 request fails. librdkafka treats -1 on Produce as permanent and drops the message.

Changes

  • backpressureErrorCode returned UNKNOWN_SERVER_ERROR for S3StateUnavailable and for the default case, which covers a failed append or read while S3 still looks healthy. Both now return KAFKA_STORAGE_ERROR. Degraded S3 still returns REQUEST_TIMED_OUT.
  • Produce sets the partition error message, which clients see on v8 and later: "object storage degraded, retry later", "object storage unavailable, retry later" or "object storage request failed, retry later". It does not include bucket names or the underlying error.
  • A partition log that cannot be restored from S3 now also returns the storage error on Produce and Fetch, instead of -1.
  • Adds KAFKA_STORAGE_ERROR to pkg/protocol/errors.go, and updates docs/architecture.md and the release notes.

Tests

  • TestProduceBackpressureUnavailable and TestFetchBackpressureUnavailable now expect 56.
  • TestProduceBackpressureErrorMessages checks the code and message on Produce v9 for degraded, unavailable and append failure.
  • TestFetchRestoreFailureReturnsStorageError covers the restore failure path.

All of them fail against main and pass with the fix.

Not covered here: the e2e or live check with a librdkafka producer through a short MinIO outage.

Fixes #255

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

@PaxMachinaOne PaxMachinaOne left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 PaxMachina automated review (worker-code)

The change correctly maps S3 failures to retriable Kafka errors without exposing sensitive storage details.

No blocking findings.

@PaxMachinaOne
PaxMachinaOne merged commit 593def4 into KafScale:main Oct 30, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return a retriable error with a clear message when S3 is unavailable

2 participants