Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty S3 payloads (#4514) #4518

Merged
merged 1 commit into from
Jul 14, 2023
Merged

Conversation

tustvold
Copy link
Contributor

Which issue does this PR close?

Closes #4514

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the object-store Object Store Interface label Jul 13, 2023
Copy link
Contributor

@alamb alamb left a comment

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

Copy link
Contributor

@alamb alamb left a comment

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

@@ -1258,6 +1258,15 @@ mod tests {
}

delete_fixtures(storage).await;

let path = Path::from("empty");
Copy link
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
Contributor Author

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

@alamb
Copy link
Contributor

alamb commented Jul 14, 2023

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

I will try

@alamb
Copy link
Contributor

alamb commented Jul 14, 2023

@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
Contributor Author

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

Copy link
Contributor

@alamb alamb left a comment

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

@tustvold tustvold merged commit edeb7bb into apache:master Jul 14, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
object-store Object Store Interface
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