Skip to content

feat(storage): implement replay buffer for appendable upload - #6605

Open
vsharonlynn wants to merge 3 commits into
googleapis:mainfrom
vsharonlynn:replay-foundation
Open

feat(storage): implement replay buffer for appendable upload#6605
vsharonlynn wants to merge 3 commits into
googleapis:mainfrom
vsharonlynn:replay-foundation

Conversation

@vsharonlynn

@vsharonlynn vsharonlynn commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Issue #5716 .

@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 introduces a new ReplayBuffer module to manage unacknowledged data chunks, trim acknowledged data, and support resending chunks upon stream reconnection. The reviewer suggested refactoring the acknowledge method to separate the loop logic and adding a safety comment explaining the invariants when slicing the chunk data.

Comment thread src/storage/src/storage/bidi_write/replay_buffer.rs Outdated
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.67442% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.72%. Comparing base (f02b42c) to head (cdefb94).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...rc/storage/src/storage/bidi_write/replay_buffer.rs 97.67% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6605      +/-   ##
==========================================
- Coverage   96.72%   96.72%   -0.01%     
==========================================
  Files         313      314       +1     
  Lines      101266   101438     +172     
==========================================
+ Hits        97948    98112     +164     
- Misses       3318     3326       +8     

☔ 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.

Comment on lines +24 to +25
/// Defines the maximum capacity of the replay buffer in bytes (32 MiB).
pub const MAX_REPLAY_BUFFER_SIZE: usize = 32 * 1024 * 1024;

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.

Is 32MiB the "One True Value" for some reason? Shouldn't this be configurable? If not, could you add a comment explaining why this is the only correct value?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, it's not the one true value. It is the intended default.

Added with_capacity method. Currently default value is 32MiB.
I'll write follow-up PRs on setting this at the request level (and maybe client-level) to keep this PR focused on replay_buffer.rs.

Thanks Carlos.

Comment thread src/storage/src/storage/bidi_write/replay_buffer.rs Outdated
Comment thread src/storage/src/storage/bidi_write/replay_buffer.rs Outdated
Comment thread src/storage/src/storage/bidi_write/replay_buffer.rs Outdated
@vsharonlynn vsharonlynn changed the title feat(storage): implement 32 MiB replay buffer for appendable upload feat(storage): implement replay buffer for appendable upload Sep 8, 2026
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.

3 participants