Skip to content

ref(objectstore): Initiate multipart upload#6172

Merged
jjbayer merged 32 commits into
masterfrom
ref/objectstore-multipart
Jul 9, 2026
Merged

ref(objectstore): Initiate multipart upload#6172
jjbayer merged 32 commits into
masterfrom
ref/objectstore-multipart

Conversation

@jjbayer

@jjbayer jjbayer commented Jul 3, 2026

Copy link
Copy Markdown
Member

Use Objectstore's multipart upload feature for large attachment uploads. The purpose of this PR is to validate the robustness of multipart uploads. The next step will be to allow resumable uploads.

Closes INGEST-773.

@linear-code

linear-code Bot commented Jul 3, 2026

Copy link
Copy Markdown

INGEST-773

@jjbayer

jjbayer commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

@sentry review

Comment thread relay-server/src/services/upload.rs Outdated
Comment thread relay-server/src/services/objectstore.rs Outdated
use super::outcome::Outcome;

/// Size of an individual request to objectstore.
const CHUNK_SIZE: NonZeroUsize = NonZeroUsize::new(5 * 1024 * 1024).unwrap();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Chunking is necessary because Objectstore expects a content length. See code comments further below.

TraceAttachment(Managed<StoreTraceAttachment>),
EventAttachment(Managed<StoreAttachment>),
RawProfile(Managed<StoreRawProfile>),
Create(Create, Sender<Result<UploadRef, Error>>),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There was previously no Create message because a "create" call to the upload endpoint generated an Objectstore key on the Relay side. For multipart uploads, the upload session needs to be created on the Objectstore side.

pub key: String,
/// The ID of the multipart upload session (chosen by objectstore).
/// `None` if the upload is not multipart.
pub upload_id: Option<UploadId>,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For now, upload_id is only none if the location was created by an older relay instance. We might use None as an optimization for small uploads in the future though.

Comment thread tests/integration/test_upload.py Outdated
@jjbayer jjbayer marked this pull request as ready for review July 8, 2026 15:22
@jjbayer jjbayer requested a review from a team as a code owner July 8, 2026 15:22
Comment thread relay-server/src/services/upload.rs
Comment thread relay-server/src/services/objectstore.rs Outdated
Comment thread relay-server/src/services/objectstore.rs
Comment thread relay-server/src/utils/stream/rechunked.rs

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 511c411. Configure here.

.key(&key)
.compression(Compression::Zstd) // make explicit because parts need to be manually compressed.
.send()
.await?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Create initiate lacks objectstore retries

Medium Severity

handle_create calls initiate_multipart_upload once with no retry loop, while stream uploads use upload() with configurable max_attempts and is_retryable backoff. Transient objectstore 5xx or connection errors on POST create now fail upload session creation immediately instead of being retried like PATCH uploads.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 511c411. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

True, but I won't add to the complexity unless we actually need it.

@jjbayer jjbayer added this pull request to the merge queue Jul 9, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 9, 2026
@jjbayer jjbayer added this pull request to the merge queue Jul 9, 2026
Merged via the queue into master with commit 0f0a927 Jul 9, 2026
35 checks passed
@jjbayer jjbayer deleted the ref/objectstore-multipart branch July 9, 2026 14:35
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.

2 participants