Skip to content

Commit

Permalink
Update to AWS SDK 1.11.223 (#27278)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlrx committed Nov 14, 2017
1 parent bda9257 commit 5a5c581
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/plugins/repository-s3.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ The following settings are supported:

`use_throttle_retries`::

Set to `true` if you want to throttle retries. Defaults to AWS SDK default value (`false`).
Set to `true` if you want to throttle retries. Defaults to AWS SDK default value (`true`).

`readonly`::

Expand Down
11 changes: 10 additions & 1 deletion plugins/repository-s3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ esplugin {
}

versions << [
'aws': '1.10.69'
'aws': '1.11.223'
]

dependencies {
Expand Down Expand Up @@ -83,6 +83,15 @@ thirdPartyAudit.excludes = [
'org.apache.avalon.framework.logger.Logger',
'org.apache.log.Hierarchy',
'org.apache.log.Logger',
'software.amazon.ion.IonReader',
'software.amazon.ion.IonSystem',
'software.amazon.ion.IonType',
'software.amazon.ion.IonWriter',
'software.amazon.ion.Timestamp',
'software.amazon.ion.system.IonBinaryWriterBuilder',
'software.amazon.ion.system.IonSystemBuilder',
'software.amazon.ion.system.IonTextWriterBuilder',
'software.amazon.ion.system.IonWriterBuilder',
]

// jarhell with jdk (intentionally, because jaxb was removed from default modules in java 9)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c3993cb44f5856fa721b7b7ccfc266377c0bf9c0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c24e6ebe108c60a08098aeaad5ae0b6a5a77b618

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c2ef96732e22d97952fbcd0a94f1dc376d157eda
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

package org.elasticsearch.repositories.s3;

import com.amazonaws.AmazonClientException;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.AmazonS3Exception;
import com.amazonaws.services.s3.model.CannedAccessControlList;
import com.amazonaws.services.s3.model.CreateBucketRequest;
import com.amazonaws.services.s3.model.DeleteObjectsRequest;
Expand All @@ -38,6 +36,8 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeValue;

import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Locale;

Expand Down Expand Up @@ -73,18 +73,22 @@ class S3BlobStore extends AbstractComponent implements BlobStore {
// Also, if invalid security credentials are used to execute this method, the
// client is not able to distinguish between bucket permission errors and
// invalid credential errors, and this method could return an incorrect result.
if (!client.doesBucketExist(bucket)) {
deprecationLogger.deprecated("Auto creation of the bucket for an s3 backed " +
"repository is deprecated and will be removed in 6.0.");
final CreateBucketRequest request;
if (region != null) {
request = new CreateBucketRequest(bucket, region);
} else {
request = new CreateBucketRequest(bucket);
final CannedAccessControlList cAcl = this.cannedACL;
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
if (!client.doesBucketExist(bucket)) {
deprecationLogger.deprecated("Auto creation of the bucket for an s3 backed " +
"repository is deprecated and will be removed in 6.0.");
final CreateBucketRequest request;
if (region != null) {
request = new CreateBucketRequest(bucket, region);
} else {
request = new CreateBucketRequest(bucket);
}
request.setCannedAcl(cAcl);
client.createBucket(request);
}
request.setCannedAcl(this.cannedACL);
client.createBucket(request);
}
return null;
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.HttpMethod;
import com.amazonaws.regions.Region;
import com.amazonaws.services.s3.AbstractAmazonS3;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.S3ClientOptions;
import com.amazonaws.services.s3.S3ResponseMetadata;
Expand Down Expand Up @@ -121,15 +122,14 @@
*
*/
@SuppressForbidden(reason = "implements AWS api that uses java.io.File!")
public class AmazonS3Wrapper implements AmazonS3 {
public class AmazonS3Wrapper extends AbstractAmazonS3 {

protected AmazonS3 delegate;

public AmazonS3Wrapper(AmazonS3 delegate) {
this.delegate = delegate;
}


@Override
public void setEndpoint(String endpoint) {
delegate.setEndpoint(endpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ protected void launchAWSCredentialsWithElasticsearchSettingsTest(Settings single

public void testAWSDefaultConfiguration() {
Settings repositorySettings = generateRepositorySettings(null, null, "eu-central", null, null);
launchAWSConfigurationTest(Settings.EMPTY, repositorySettings, Protocol.HTTPS, null, -1, null, null, null, 3, false,
ClientConfiguration.DEFAULT_SOCKET_TIMEOUT);
launchAWSConfigurationTest(Settings.EMPTY, repositorySettings, Protocol.HTTPS, null, -1, null, null, null, 3,
ClientConfiguration.DEFAULT_THROTTLE_RETRIES, ClientConfiguration.DEFAULT_SOCKET_TIMEOUT);
}

public void testAWSConfigurationWithAwsSettings() {
Expand All @@ -233,7 +233,7 @@ public void testAWSConfigurationWithAwsSettings() {
.put("s3.client.default.read_timeout", "10s")
.build();
launchAWSConfigurationTest(settings, repositorySettings, Protocol.HTTP, "aws_proxy_host", 8080, "aws_proxy_username",
"aws_proxy_password", null, 3, false, 10000);
"aws_proxy_password", null, 3, ClientConfiguration.DEFAULT_THROTTLE_RETRIES, 10000);
}

public void testAWSConfigurationWithAwsSettingsBackcompat() {
Expand All @@ -248,7 +248,7 @@ public void testAWSConfigurationWithAwsSettingsBackcompat() {
.put(AwsS3Service.READ_TIMEOUT.getKey(), "10s")
.build();
launchAWSConfigurationTest(settings, repositorySettings, Protocol.HTTP, "aws_proxy_host", 8080, "aws_proxy_username",
"aws_proxy_password", "AWS3SignerType", 3, false, 10000);
"aws_proxy_password", "AWS3SignerType", 3, ClientConfiguration.DEFAULT_THROTTLE_RETRIES, 10000);
assertSettingDeprecationsAndWarnings(new Setting<?>[]{
AwsS3Service.PROXY_USERNAME_SETTING,
AwsS3Service.PROXY_PASSWORD_SETTING,
Expand Down Expand Up @@ -278,7 +278,7 @@ public void testAWSConfigurationWithAwsAndS3SettingsBackcompat() {
.put(AwsS3Service.CLOUD_S3.READ_TIMEOUT.getKey(), "10s")
.build();
launchAWSConfigurationTest(settings, repositorySettings, Protocol.HTTPS, "s3_proxy_host", 8081, "s3_proxy_username",
"s3_proxy_password", "NoOpSignerType", 3, false, 10000);
"s3_proxy_password", "NoOpSignerType", 3, ClientConfiguration.DEFAULT_THROTTLE_RETRIES, 10000);
assertSettingDeprecationsAndWarnings(new Setting<?>[] {
AwsS3Service.PROXY_USERNAME_SETTING,
AwsS3Service.PROXY_PASSWORD_SETTING,
Expand All @@ -301,7 +301,7 @@ public void testGlobalMaxRetriesBackcompat() {
.put(S3Repository.Repositories.MAX_RETRIES_SETTING.getKey(), 10)
.build();
launchAWSConfigurationTest(settings, Settings.EMPTY, Protocol.HTTPS, null, -1, null, null,
null, 10, false, 50000);
null, 10, ClientConfiguration.DEFAULT_THROTTLE_RETRIES, ClientConfiguration.DEFAULT_SOCKET_TIMEOUT);
assertSettingDeprecationsAndWarnings(new Setting<?>[]{
S3Repository.Repositories.MAX_RETRIES_SETTING
});
Expand All @@ -312,7 +312,7 @@ public void testRepositoryMaxRetries() {
.put("s3.client.default.max_retries", 5)
.build();
launchAWSConfigurationTest(settings, Settings.EMPTY, Protocol.HTTPS, null, -1, null, null,
null, 5, false, 50000);
null, 5, ClientConfiguration.DEFAULT_THROTTLE_RETRIES, ClientConfiguration.DEFAULT_SOCKET_TIMEOUT);
}

public void testRepositoryMaxRetriesBackcompat() {
Expand All @@ -321,7 +321,7 @@ public void testRepositoryMaxRetriesBackcompat() {
.put(S3Repository.Repositories.MAX_RETRIES_SETTING.getKey(), 10)
.build();
launchAWSConfigurationTest(settings, repositorySettings, Protocol.HTTPS, null, -1, null,
null, null, 20, false, 50000);
null, null, 20, ClientConfiguration.DEFAULT_THROTTLE_RETRIES, ClientConfiguration.DEFAULT_SOCKET_TIMEOUT);
assertSettingDeprecationsAndWarnings(new Setting<?>[]{
S3Repository.Repositories.MAX_RETRIES_SETTING,
S3Repository.Repository.MAX_RETRIES_SETTING
Expand Down

0 comments on commit 5a5c581

Please sign in to comment.