Skip to content

Handle empty S3 payloads (#4514)#4518

Merged
tustvold merged 1 commit into
apache:masterfrom
tustvold:s3-empty-payload
Jul 14, 2023
Merged

Handle empty S3 payloads (#4514)#4518
tustvold merged 1 commit into
apache:masterfrom
tustvold:s3-empty-payload

Conversation

@tustvold

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes apache/arrow-rs-object-store#155

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@alamb alamb 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.

The code looks good to me -- thank you @tustvold

I am just verifying the test coverage... Hang tight

@alamb alamb 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.

The code looks good, but I am not sure about the test

Comment thread object_store/src/lib.rs

delete_fixtures(storage).await;

let path = Path::from("empty");

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.

This test appears to pass even without the code changes in this PR. See #4519 for example

@tustvold

Copy link
Copy Markdown
Contributor Author

You need to test against real S3, the emulator doesn't seem to exhibit the same issue

@alamb

alamb commented Jul 14, 2023

Copy link
Copy Markdown
Contributor

You need to test against real S3, the emulator doesn't seem to exhibit the same issue

I will try

@alamb

alamb commented Jul 14, 2023

Copy link
Copy Markdown
Contributor

@tustvold can you give me the command you used run the tests against a real S3 bucket (obviously I will supply my own AWS credentials)

I got this far (but then I stumbled on what the "metadata endpoint" should be

TEST_INTEGRATION=1 OBJECT_STORE_BUCKET=foo  cargo test -p object_store --features=aws

@tustvold

Copy link
Copy Markdown
Contributor Author

Just omit the endpoint, note also that the credential names should be prefixed by OBJECT_STORE

@alamb alamb 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.

Ok, I ran the new test against an actual S3 bucket and without the code changes in this PR it fails like this:


---- aws::tests::s3_test stdout ----
thread 'aws::tests::s3_test' panicked at 'called `Result::unwrap()` on an `Err` value: Generic { store: "S3", source: Error { retries: 0, message: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>MissingContentLength</Code><Message>You must provide the Content-Length HTTP header.</Message><RequestId>....</RequestId><HostId>....</HostId></Error>", source: Some(reqwest::Error { kind: Status(411), url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("s3.us-east-1.amazonaws.com")), port: None, path: "/alamb-test-bucket/empty", query: None, fragment: None } }), status: Some(411) } }', src/lib.rs:1263:48

With this PR it passes

Nice work @tustvold -- thank you

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.

object_store: Uploading empty file to S3 results in "411 Length Required"

2 participants