diff --git a/docs/src/main/sphinx/object-storage/file-system-s3.md b/docs/src/main/sphinx/object-storage/file-system-s3.md index f189df1b5362..1453c5d0da9c 100644 --- a/docs/src/main/sphinx/object-storage/file-system-s3.md +++ b/docs/src/main/sphinx/object-storage/file-system-s3.md @@ -79,8 +79,8 @@ support: * - `s3.socket-connect-timeout` - Maximum time [duration](prop-type-duration) allowed for socket connection requests to complete before timing out. -* - `s3.socket-read-timeout` - - Maximum time [duration](prop-type-duration) for socket read operations +* - `s3.socket-timeout` + - Maximum time [duration](prop-type-duration) for socket read/write operations before timing out. * - `s3.tcp-keep-alive` - Enable TCP keep alive on created connections. Defaults to `false`. @@ -383,7 +383,7 @@ the following edits to your catalog configuration: - Also see `s3.connection-max-idle-time` in preceding section for more connection keep-alive options. * - `hive.s3.socket-timeout` - - `s3.socket-read-timeout` + - `s3.socket-timeout` - Also see `s3.tcp-keep-alive` in preceding sections for more socket connection keep-alive options. * - `hive.s3.max-connections` diff --git a/lib/trino-filesystem-s3/src/main/java/io/trino/filesystem/s3/S3FileSystemConfig.java b/lib/trino-filesystem-s3/src/main/java/io/trino/filesystem/s3/S3FileSystemConfig.java index 8761351204f6..091fa38d4713 100644 --- a/lib/trino-filesystem-s3/src/main/java/io/trino/filesystem/s3/S3FileSystemConfig.java +++ b/lib/trino-filesystem-s3/src/main/java/io/trino/filesystem/s3/S3FileSystemConfig.java @@ -19,6 +19,7 @@ import io.airlift.configuration.Config; import io.airlift.configuration.ConfigDescription; import io.airlift.configuration.ConfigSecuritySensitive; +import io.airlift.configuration.LegacyConfig; import io.airlift.units.DataSize; import io.airlift.units.Duration; import io.airlift.units.MaxDataSize; @@ -163,7 +164,7 @@ public static RetryStrategy getRetryStrategy(RetryMode retryMode) private Duration connectionTtl; private Duration connectionMaxIdleTime; private Duration socketConnectTimeout; - private Duration socketReadTimeout; + private Duration socketTimeout; private boolean tcpKeepAlive; private HostAndPort httpProxy; private boolean httpProxySecure; @@ -511,16 +512,17 @@ public S3FileSystemConfig setSocketConnectTimeout(Duration socketConnectTimeout) return this; } - public Optional getSocketReadTimeout() + public Optional getSocketTimeout() { - return Optional.ofNullable(socketReadTimeout); + return Optional.ofNullable(socketTimeout); } - @Config("s3.socket-read-timeout") - @ConfigDescription("Maximum time allowed for socket reads before timing out") - public S3FileSystemConfig setSocketReadTimeout(Duration socketReadTimeout) + @LegacyConfig("s3.socket-read-timeout") + @Config("s3.socket-timeout") + @ConfigDescription("Maximum time allowed for socket reads/writes before timing out") + public S3FileSystemConfig setSocketTimeout(Duration socketTimeout) { - this.socketReadTimeout = socketReadTimeout; + this.socketTimeout = socketTimeout; return this; } diff --git a/lib/trino-filesystem-s3/src/main/java/io/trino/filesystem/s3/S3FileSystemLoader.java b/lib/trino-filesystem-s3/src/main/java/io/trino/filesystem/s3/S3FileSystemLoader.java index 9a28d91f2008..4d6b4bad3d39 100644 --- a/lib/trino-filesystem-s3/src/main/java/io/trino/filesystem/s3/S3FileSystemLoader.java +++ b/lib/trino-filesystem-s3/src/main/java/io/trino/filesystem/s3/S3FileSystemLoader.java @@ -301,7 +301,7 @@ private static SdkHttpClient createHttpClient(S3FileSystemConfig config) config.getConnectionTtl().ifPresent(ttl -> client.connectionTimeToLive(ttl.toJavaTime())); config.getConnectionMaxIdleTime().ifPresent(time -> client.connectionMaxIdleTime(time.toJavaTime())); config.getSocketConnectTimeout().ifPresent(timeout -> client.connectionTimeout(timeout.toJavaTime())); - config.getSocketReadTimeout().ifPresent(timeout -> client.socketTimeout(timeout.toJavaTime())); + config.getSocketTimeout().ifPresent(timeout -> client.socketTimeout(timeout.toJavaTime())); if (config.getHttpProxy() != null) { client.proxyConfiguration(ProxyConfiguration.builder() diff --git a/lib/trino-filesystem-s3/src/test/java/io/trino/filesystem/s3/TestS3FileSystemConfig.java b/lib/trino-filesystem-s3/src/test/java/io/trino/filesystem/s3/TestS3FileSystemConfig.java index 7ef044bed25b..9db0334d2e58 100644 --- a/lib/trino-filesystem-s3/src/test/java/io/trino/filesystem/s3/TestS3FileSystemConfig.java +++ b/lib/trino-filesystem-s3/src/test/java/io/trino/filesystem/s3/TestS3FileSystemConfig.java @@ -67,7 +67,7 @@ public void testDefaults() .setConnectionTtl(null) .setConnectionMaxIdleTime(null) .setSocketConnectTimeout(null) - .setSocketReadTimeout(null) + .setSocketTimeout(null) .setTcpKeepAlive(false) .setHttpProxy(null) .setHttpProxySecure(false) @@ -109,7 +109,7 @@ public void testExplicitPropertyMappings() .put("s3.connection-ttl", "1m") .put("s3.connection-max-idle-time", "2m") .put("s3.socket-connect-timeout", "3m") - .put("s3.socket-read-timeout", "4m") + .put("s3.socket-timeout", "4m") .put("s3.tcp-keep-alive", "true") .put("s3.http-proxy", "localhost:8888") .put("s3.http-proxy.secure", "true") @@ -148,7 +148,7 @@ public void testExplicitPropertyMappings() .setConnectionTtl(new Duration(1, MINUTES)) .setConnectionMaxIdleTime(new Duration(2, MINUTES)) .setSocketConnectTimeout(new Duration(3, MINUTES)) - .setSocketReadTimeout(new Duration(4, MINUTES)) + .setSocketTimeout(new Duration(4, MINUTES)) .setTcpKeepAlive(true) .setHttpProxy(HostAndPort.fromParts("localhost", 8888)) .setHttpProxySecure(true)