Skip to content

io: retry throttled HTTP BLOB reads with Retry-After - #1548

Open
YannByron wants to merge 3 commits into
apache:mainfrom
YannByron:codex/http-blob-retry-after
Open

YannByron wants to merge 3 commits into
apache:mainfrom
YannByron:codex/http-blob-retry-after

Conversation

@YannByron

@YannByron YannByron commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Closes #1547.

HTTP BLOB reads currently fail immediately on 429, even when the origin supplies Retry-After. Retry rejected requests before opening a successful body so transient throttling does not turn concurrent descriptor reads into immediate query failures.

This addresses the native-reader issue identified in apache/paimon#11431, originally reproduced at its commit ca47d2acd254d5b5684d15df7f4661743e1daa23. It is independent of the Python default-concurrency change and does not change the Rust default concurrency.

Brief change log

  • Retry only HTTP 429, at most three retries after the initial GET.
  • Honor delta-seconds and HTTP-date Retry-After; use 100/200/400 ms backoff when the header is absent or malformed.
  • Cap cumulative retry sleeps at 30 seconds. A server delay beyond the remaining budget fails immediately rather than retrying before the server permits it. This is a waiting budget, not a new timeout for network I/O.
  • Drop rejected responses before sleeping. Do not replay successful response bodies or retry other status codes. Preserve sanitized errors.
  • Make the already locked httpdate crate a direct dependency; no dependency versions change.

Tests

  • A real HTTP server returns 429 once with Retry-After: 1; the regression fails on the base revision and passes after the fix, checking the delay, request count, and selected bytes.
  • Cover HTTP dates, malformed/absent headers, retry and waiting limits, numeric overflow, persistent 429, non-retryable 403/503, and signed-URL/error-body sanitization.
  • Existing decoded-offset and stream-reuse regression remains green.
  • cargo test --locked --offline -p paimon --lib io::uri_reader: 5 passed.
  • cargo fmt --all --check and git diff --check: passed.

API and Format

No public API, default concurrency, or storage-format changes. Throttled HTTP origins may now succeed after bounded waiting rather than fail on the first response.

Documentation

The retry bounds and response-body boundary are documented in the implementation.

The Python capability flag was removed following review. The already merged Python consumer in apache/paimon#11431 still falls back to concurrency 1 when the flag is absent; changing that default belongs in a separate Python-side change, not this HTTP retry fix.

Honor Retry-After with bounded attempts and cumulative retry waiting.
Retain successful-body streaming, cancellation and sanitized HTTP errors.

Co-Authored-By: Codex <noreply@anthropic.com>
AI-Model: gpt-6
Co-Authored-By: Codex <noreply@ai-tool.com>
AI-Contributed/Feature: 176/176
AI-Contributed/UT: 0/0
Export the retry capability from the native extension so callers can
retain serial defaults with runtimes lacking bounded HTTP 429 recovery.

Co-Authored-By: Codex <noreply@anthropic.com>
AI-Model: gpt-6
Co-Authored-By: Codex <noreply@ai-tool.com>
AI-Contributed/Feature: 3/3
AI-Contributed/UT: 8/8
Comment thread bindings/python/src/lib.rs Outdated
fn pypaimon_rust(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
// Python callers can retain serial defaults with older runtimes that
// cannot recover from transient throttling of concurrent HTTP BLOB reads.
m.add("HTTP_BLOB_RETRY_SUPPORTED", true)?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe just modify default value? It looks like we don't need to worry about compatibility here.

Keep the HTTP retry fix independent of Python default-concurrency policy,
as requested in review. Remove the capability-only binding test as well.

Co-Authored-By: Codex <noreply@anthropic.com>
AI-Model: gpt-6
AI-Contributed/Feature: 3/3
AI-Contributed/UT: 8/8
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.

Retry HTTP BLOB reads throttled with 429 and Retry-After

2 participants