Skip to content

feat(storage): integrate replay buffer and reconnect into appendable upload worker - #6607

Draft
vsharonlynn wants to merge 7 commits into
googleapis:mainfrom
vsharonlynn:replay-worker
Draft

vsharonlynn wants to merge 7 commits into
googleapis:mainfrom
vsharonlynn:replay-worker

Conversation

@vsharonlynn

@vsharonlynn vsharonlynn commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Issue #5716 .

This PR follows PR #6606 .

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Sep 1, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request implements automatic reconnection and unacknowledged chunk replay for bidirectional streaming writes. It introduces a new ReplayBuffer module to retain unacknowledged data chunks and trim them upon server confirmation. The background Worker and Connector are updated to handle stream failures, perform reconnection, and replay any unpersisted chunks and pending flush/finalize requests. Comprehensive unit and integration tests are also added to verify the reconnection and replay behavior. I have no feedback to provide as there are no review comments.

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.06742% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.17%. Comparing base (5064632) to head (a361574).

Files with missing lines Patch % Lines
src/storage/src/storage/bidi_write/worker.rs 94.49% 24 Missing ⚠️
...rc/storage/src/storage/bidi_write/replay_buffer.rs 97.67% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6607      +/-   ##
==========================================
- Coverage   97.17%   97.17%   -0.01%     
==========================================
  Files         328      329       +1     
  Lines      109802   110452     +650     
==========================================
+ Hits       106702   107333     +631     
- Misses       3100     3119      +19     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Drop the unreachable expect() by reading the front chunk length before
  popping it, removing the redundant panic branch.
- Relabel the // SAFETY: comment as // Invariant:, since Bytes::slice is
  safe Rust and the comment documents an algorithmic invariant, not an
  unsafe contract.
The replay buffer gates the worker's intent branch on `is_full()`, but the
buffer is only drained by `ack()`, which requires a server response. Nothing
in the append path requested one, so ~32 MiB of appends without an explicit
flush stalled the worker permanently and blocked the caller inside `append()`.

Inject `flush` + `state_lookup` on the append that crosses a high watermark,
and re-establish the invariant after reconnect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant