Skip to content

feat(server): retry failed or slow puts, upload large objects in parts - #5085

Open
numinnex wants to merge 4 commits into
geo_persisted_consumer_offsetsfrom
upload_retries_and_parts
Open

numinnex wants to merge 4 commits into
geo_persisted_consumer_offsetsfrom
upload_retries_and_parts

Conversation

@numinnex

@numinnex numinnex commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

A producer of a geo topic waits for the upload of its fresh object, so
the slowest put is the slowest send. On GCS the median put took about
70 ms, but about one in 4,500 took over a second and some took
several. A put was never sent again and was given up only after 30 s
without progress, so a put that was slow but alive was simply waited
for. A long-term segment of up to 64 MiB was also stored with one put,
which limits one partition's rewrite to about one stream's worth of
data.

A put whose body is held in memory is now sent again after a transient
failure. Every attempt carries the same put id in the object's
metadata. A create-only put that the store refuses after an earlier
attempt may have reached it counts as stored only when the object
under its key carries that id, its size and its CRC32C. A request that
provably never left is told apart from one whose answer was lost.

A create-only put that runs past a threshold for its size gets a
second attempt on another connection, with slots of its own, and the
first to store the object wins. The defaults are about the 99th
percentile by size from benchmark sends on GCS. An attempt at a
create-only put is given up after 1 s without body progress or 5 s
without an answer. Overwrites are retried but keep the 30 s timeout
and get no second attempt, because one cut early could land after a
later put of other bytes. Puts that stream a sealed segment from its
file are unchanged.

The long-term rewrite lets a segment of at least twice the part size
go up in parts, side by side within a budget per shard. On S3 that is
a multipart upload with a full object CRC32C. GCS refuses
preconditions on its multipart API, so there each part is a temporary
object and a compose joins them. Either way one request creates the
object, create-only, and the CRC32C of all of it is checked. A part is
sent again after a failure but gets no second attempt: a part replaces
what is under its name, so the attempt that loses could land after the
object exists and leave a temporary object behind. Every other put
stays whole, the fresh objects that producers wait for included,
because parts lose to one put for objects below about 32 MiB.

An upload in parts that ends without its object is aborted. What a
crash leaves is removed by a sweep on shard 0 of the metadata primary,
behind the store identity check, once it is older than a grace. An
upload gives up at half the grace, so the sweep never meets a live
one.

Measured on real GCS buckets: with second attempts on, none of 731,881
sends took over 1 s, against 791 of 668,872 with them off, for 0.2 to
0.35% more put requests. One partition fed at 95 MB/s was rewritten at
59 MB/s in parts and 39 MB/s with one put per segment, so the rewrite
is faster but still falls behind such a partition.

A producer of a geo topic waits for the upload of its fresh object, so
the slowest put is the slowest send. On GCS the median put took about
70 ms, but about one in 4,500 took over a second and some took several.
A put was never sent again and was given up only after 30 s without
progress, so a put that was slow but alive was simply waited for.

A put whose body is held in memory is now sent again after a transient
failure. Every attempt carries the same put id in the object's
metadata. A create-only put that the store refuses after an earlier
attempt may have reached it counts as stored only when the object
under its key carries that id, its size and its CRC32C. A request that
provably never left is told apart from one whose answer was lost.

A create-only put that runs past a threshold for its size gets a second
attempt on another connection, with slots of its own, and the first to
store the object wins. The defaults are about the 99th percentile by
size from the GCS benchmark sends. An attempt at a create-only put is
given up after 1 s without body progress or 5 s without an answer.

Overwrites are retried but keep the 30 s timeout and get no second
attempt, because one cut early could land after a later put of other
bytes. Puts that stream a sealed segment from its file are unchanged.
@numinnex
numinnex added this pull request to stack #5048 November 25, 2026 10:20
@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.53642% with 287 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (geo_persisted_consumer_offsets@1511617). Learn more about missing BASE report.

Files with missing lines Patch % Lines
core/server/src/upload_sweep.rs 74.47% 47 Missing and 2 partials ⚠️
core/object_store/src/store.rs 63.93% 42 Missing and 2 partials ⚠️
core/object_store/src/gcs/mod.rs 92.05% 24 Missing and 17 partials ⚠️
core/shard/src/tier_service/store/parts.rs 86.53% 31 Missing and 4 partials ⚠️
core/object_store/src/s3/mod.rs 95.76% 11 Missing and 12 partials ⚠️
core/object_store/src/backend.rs 71.87% 18 Missing ⚠️
core/partitions/src/fresh_upload.rs 69.23% 16 Missing ⚠️
core/shard/src/tier_service/store.rs 95.50% 11 Missing and 4 partials ⚠️
core/object_store/src/http.rs 90.71% 13 Missing ⚠️
core/object_store/src/s3/xml.rs 79.03% 8 Missing and 5 partials ⚠️
... and 4 more

❌ Your patch check has failed because the patch coverage (5.94%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@                        Coverage Diff                        @@
##             geo_persisted_consumer_offsets    #5085   +/-   ##
=================================================================
  Coverage                                  ?   92.20%           
  Complexity                                ?     4365           
=================================================================
  Files                                     ?     1587           
  Lines                                     ?   428983           
  Branches                                  ?   357436           
=================================================================
  Hits                                      ?   395532           
  Misses                                    ?    27872           
  Partials                                  ?     5579           
Components Coverage Δ
Rust Core 93.51% <0.00%> (?)
Java SDK 81.01% <0.00%> (?)
C# SDK 86.31% <0.00%> (?)
Python SDK 85.41% <0.00%> (?)
PHP SDK 90.42% <0.00%> (?)
Node SDK 97.26% <0.00%> (?)
Go SDK 73.78% <0.00%> (?)
C++ SDK 85.44% <0.00%> (?)
Files with missing lines Coverage Δ
core/configs/src/server_config/tiered_storage.rs 99.73% <100.00%> (ø)
core/object_store/src/error.rs 100.00% <100.00%> (ø)
core/object_store/src/identity.rs 95.27% <100.00%> (ø)
core/object_store/src/layout.rs 97.36% <100.00%> (ø)
core/object_store/src/recovery.rs 91.16% <100.00%> (ø)
core/partitions/src/lib.rs 58.82% <ø> (ø)
core/partitions/src/long_term_rewrite.rs 93.09% <100.00%> (ø)
core/partitions/src/origin_recovery.rs 90.38% <100.00%> (ø)
core/server/src/lib.rs 100.00% <ø> (ø)
core/server/src/origin_recovery.rs 77.41% <100.00%> (ø)
... and 18 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

A long-term segment of up to 64 MiB was stored with one put. One stream
to the store carries about 80 MB/s, so a full segment took most of a
second and one partition's rewrite could store about one stream's
worth of data.

The rewrite now lets the put of a segment of at least twice the part
size go up in parts, sent side by side within a budget per shard. On
S3 that is a multipart upload with a full object CRC32C. GCS refuses
preconditions on its multipart API, so there each part is a temporary
object and a compose joins them. Either way one request creates the
object, create-only, and the CRC32C of all of it is checked. Each part
is sent again and given a second attempt as a put is, and a lost answer
to the creating request is settled by the put id as before. A store
that refuses uploads in parts gets one put from then on.

Every other put stays whole, the fresh objects that producers wait for
included, because nothing is measured for them yet.

An upload that ends without its object is aborted. What a crash leaves
is removed by a sweep on shard 0 of the metadata primary, behind the
store identity check, once it is older than a grace. An upload gives up
at half the grace, so the sweep never meets a live one.
@numinnex numinnex changed the title feat(server): retry failed puts and give slow ones a second attempt feat(server): retry failed or slow puts, upload large objects in parts Nov 25, 2026
@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Nov 25, 2026
A part replaces what is under its name, so of two attempts at one part
the one that loses could still land after the store had the object. On
a real GCS bucket a live cluster left 18 temporary objects of 8 MiB
behind over 146 uploads: the losing attempt was dropped, GCS committed
the body it had already received, and that recreated the temporary
after the compose had deleted it. One that lands before the compose
replaces the generation the compose names, which fails the upload.

A part is now sent one attempt at a time. It is still sent again after
a failure, and a slow one is cut by the attempt deadlines. Whole
create-only puts keep their second attempt, because the store refuses
the one that lands late.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review PR is waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant