-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Support weaker consistency model for S3 MPUs #138663
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
Changes from all commits
8aa2e41
9372631
a62babd
5b93838
251d158
5ab7cd5
b8074ca
1fc5805
982e0e6
94b3ceb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 138663 | ||
| summary: Support weaker consistency model for S3 MPUs | ||
| area: Snapshot/Restore | ||
| type: bug | ||
| issues: [] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the "Elastic License | ||
| * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| package fixture.s3; | ||
|
|
||
| /** | ||
| * AWS S3 has weaker consistency for its multipart upload APIs than initially claimed (see support cases 10837136441 and 176070774900712) | ||
| * but strong consistency of conditional writes based on the {@code If-Match} and {@code If-None-Match} headers. Other object storage | ||
| * suppliers have decided instead to implement strongly-consistent multipart upload APIs and ignore the conditional writes headers. We | ||
| * verify Elasticsearch's behaviour against both models. | ||
| */ | ||
| public enum S3ConsistencyModel { | ||
| /** | ||
| * The model implemented by AWS S3: multipart upload APIs are somewhat weak (e.g. aborts may return while the write operation is still | ||
| * in flight) but conditional writes work as expected. | ||
| */ | ||
| AWS_DEFAULT(true, false), | ||
|
|
||
| /** | ||
| * The alternative model verified by these tests: the multipart upload APIs are strongly consistent, but the {@code If-Match} and | ||
| * {@code If-None-Match} headers are ignored and all writes are unconditional. | ||
| */ | ||
| STRONG_MPUS(false, true); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible for a model to have both?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but that's not a very interesting case to test.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uninteresting because it should just work?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes pretty much: if both of the cases here work then the |
||
|
|
||
| private final boolean conditionalWrites; | ||
| private final boolean strongMultipartUploads; | ||
|
|
||
| S3ConsistencyModel(boolean conditionalWrites, boolean strongMultipartUploads) { | ||
| this.conditionalWrites = conditionalWrites; | ||
| this.strongMultipartUploads = strongMultipartUploads; | ||
| } | ||
|
|
||
| public boolean hasStrongMultipartUploads() { | ||
| return strongMultipartUploads; | ||
| } | ||
|
|
||
| public boolean hasConditionalWrites() { | ||
| return conditionalWrites; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,6 +70,11 @@ public void handle(final HttpExchange exchange) throws IOException { | |
| throw e; | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| protected S3ConsistencyModel consistencyModel() { | ||
| return S3HttpFixture.this.consistencyModel(); | ||
| } | ||
| }; | ||
| } | ||
|
|
||
|
|
@@ -109,4 +114,8 @@ protected void after() { | |
| ThreadPool.terminate(executorService, 10, TimeUnit.SECONDS); | ||
| } | ||
| } | ||
|
|
||
| protected S3ConsistencyModel consistencyModel() { | ||
| return S3ConsistencyModel.AWS_DEFAULT; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a benefit in randomising this between
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to use randomisation for parameters that positively shouldn't matter for the purposes of the test, but this one really does matter so it's better to test both. I tried to do tricks with parameterisation etc. but it didn't work out very nicely since we construct the |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note, are these weaker consistencies to be fixed, or "features" now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazon have not indicated any interest in making changes in this area so we have to consider this a (somewhat-undocumented) feature of AWS S3 to be dealt with on our side.