Skip to content

Comments

Add put_multipart_opts (#5435)#5652

Merged
tustvold merged 5 commits intoapache:masterfrom
tustvold:put-multipart-opts
Apr 17, 2024
Merged

Add put_multipart_opts (#5435)#5652
tustvold merged 5 commits intoapache:masterfrom
tustvold:put-multipart-opts

Conversation

@tustvold
Copy link
Contributor

Which issue does this PR close?

Closes #5435

Rationale for this change

This allows setting tags and attributes for multipart uploads

What changes are included in this PR?

Are there any user-facing changes?

Comment on lines +337 to +338
.with_attributes(opts.attributes)
.with_tags(opts.tags)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unlike AWS (and GCP which copies AWS) the tags and attributes are specified in the completion request that assembles the object

Comment on lines -365 to -380
let mut has_content_type = false;
for (k, v) in &attributes {
builder = match k {
Attribute::CacheControl => builder.header(CACHE_CONTROL, v.as_ref()),
Attribute::ContentType => {
has_content_type = true;
builder.header(CONTENT_TYPE, v.as_ref())
}
};
}

if !has_content_type {
if let Some(value) = self.config.client_options.get_content_type(path) {
builder = builder.header(CONTENT_TYPE, value);
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously we were specifying these for put_part uploads which is technically not correct (although appears to be harmless)

idempotent: false,
}
self.request(Method::PUT, to)
.idempotent(true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

CopyObject is idempotent

let etag = self.storage.write().insert(
&self.location,
buf.into(),
std::mem::take(&mut self.attributes),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Calling complete multiple times is documented as implementation defined behaviour so this is fine

@tustvold tustvold force-pushed the put-multipart-opts branch from 260b7fe to 7f482d8 Compare April 16, 2024 14:33
@tustvold tustvold merged commit 4b49c34 into apache:master Apr 17, 2024
@tustvold tustvold added the api-change Changes to the arrow API label Apr 17, 2024
alamb pushed a commit to alamb/arrow-rs that referenced this pull request Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-change Changes to the arrow API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ObjectStore::put_multipart_opts

3 participants