Browse Source

Remove default value for read_timeout setting
Fix tests and docs

Alexander Kazakov 8 years ago
parent
commit
1491e2dec9

+ 3 - 8
docs/plugins/discovery-ec2.asciidoc

@@ -133,8 +133,9 @@ with the right signer to use.
 ===== Read timeout
 
 Read timeout determines the amount of time to wait for data to be transferred over an established,
-open connection before the connection is timed out. By default,it is set to 50 seconds.
-It can be configured with `cloud.aws.read_timeout` setting:
+open connection before the connection is timed out.
+It can be configured with `cloud.aws.read_timeout` (or `cloud.aws.ec2.read_timeout`) setting:
+
 [source, yaml]
 ----
 cloud.aws.read_timeout: 30s
@@ -188,12 +189,6 @@ The following are a list of settings (prefixed with `discovery.ec2`) that can fu
     How long the list of hosts is cached to prevent further requests to the AWS API.
     Defaults to `10s`.
 
-`read_timeout`::
-
-    The amount of time to wait for data to be transferred over an established,
-    open connection before the connection is timed out. Default to value of `cloud.aws.read_timeout`.
-
-
 [IMPORTANT]
 .Binding the network host
 ==============================================

+ 3 - 8
docs/plugins/repository-s3.asciidoc

@@ -141,8 +141,9 @@ use `S3SignerType`, which is Signature Version 2.
 ===== Read timeout
 
 Read timeout determines the amount of time to wait for data to be transferred over an established,
-open connection before the connection is timed out. By default,it is set to 50 seconds.
-It can be configured with `cloud.aws.read_timeout` setting:
+open connection before the connection is timed out.
+It can be configured with `cloud.aws.read_timeout` (or `cloud.aws.s3.read_timeout`) setting:
+
 [source, yaml]
 ----
 cloud.aws.read_timeout: 30s
@@ -264,12 +265,6 @@ The following settings are supported:
     The default behaviour is to detect which access style to use based on the configured endpoint (an IP will result
     in path-style access) and the bucket being accessed (some buckets are not valid DNS names).
 
-
-`read_timeout`::
-
-    The amount of time to wait for data to be transferred over an established,
-        open connection before the connection is timed out. Default to value of `cloud.aws.read_timeout`.
-
 Note that you can define S3 repository settings for all S3 repositories in `elasticsearch.yml` configuration file.
 They are all prefixed with `repositories.s3.`. For example, you can define compression for all S3 repositories
 by setting `repositories.s3.compress: true` in `elasticsearch.yml`.

+ 1 - 1
plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2Service.java

@@ -83,7 +83,7 @@ public interface AwsEc2Service {
     /**
      * cloud.aws.read_timeout: Socket read timeout. Shared with repository-s3 plugin
      */
-    Setting<TimeValue> READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout", TimeValue.timeValueSeconds(50),
+    Setting<TimeValue> READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout", TimeValue.MINUS_ONE,
         Property.NodeScope, Property.Shared);
 
     /**

+ 4 - 1
plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java

@@ -125,7 +125,10 @@ public class AwsEc2ServiceImpl extends AbstractComponent implements AwsEc2Servic
             10,
             false);
         clientConfiguration.setRetryPolicy(retryPolicy);
-        clientConfiguration.setSocketTimeout((int) CLOUD_EC2.READ_TIMEOUT.get(settings).millis());
+
+        if (READ_TIMEOUT.exists(settings) || CLOUD_EC2.READ_TIMEOUT.exists(settings)) {
+            clientConfiguration.setSocketTimeout((int) CLOUD_EC2.READ_TIMEOUT.get(settings).millis());
+        }
 
         return clientConfiguration;
     }

+ 2 - 1
plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java

@@ -72,7 +72,8 @@ public class AwsEc2ServiceImplTests extends ESTestCase {
     }
 
     public void testAWSDefaultConfiguration() {
-        launchAWSConfigurationTest(Settings.EMPTY, Protocol.HTTPS, null, -1, null, null, null, 50000);
+        launchAWSConfigurationTest(Settings.EMPTY, Protocol.HTTPS, null, -1, null, null, null,
+            ClientConfiguration.DEFAULT_SOCKET_TIMEOUT);
     }
 
     public void testAWSConfigurationWithAwsSettings() {

+ 1 - 1
plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/AwsS3Service.java

@@ -80,7 +80,7 @@ public interface AwsS3Service extends LifecycleComponent {
     /**
      * cloud.aws.read_timeout: Socket read timeout. Shared with discovery-ec2 plugin
      */
-    Setting<TimeValue> READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout", TimeValue.timeValueSeconds(50),
+    Setting<TimeValue> READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout", TimeValue.MINUS_ONE,
         Property.NodeScope, Property.Shared);
 
     /**

+ 3 - 1
plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java

@@ -116,7 +116,9 @@ public class InternalAwsS3Service extends AbstractLifecycleComponent implements
             AwsSigner.configureSigner(awsSigner, clientConfiguration, endpoint);
         }
 
-        clientConfiguration.setSocketTimeout((int) CLOUD_S3.READ_TIMEOUT.get(settings).millis());
+        if (READ_TIMEOUT.exists(settings) || CLOUD_S3.READ_TIMEOUT.exists(settings)) {
+            clientConfiguration.setSocketTimeout((int) CLOUD_S3.READ_TIMEOUT.get(settings).millis());
+        }
 
         return clientConfiguration;
     }

+ 2 - 1
plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java

@@ -143,7 +143,8 @@ public class AwsS3ServiceImplTests extends ESTestCase {
 
     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, 50000);
+        launchAWSConfigurationTest(Settings.EMPTY, repositorySettings, Protocol.HTTPS, null, -1, null, null, null, 3, false,
+            ClientConfiguration.DEFAULT_SOCKET_TIMEOUT);
     }
 
     public void testAWSConfigurationWithAwsSettings() {