Skip to content

Commit

Permalink
don't add request level timeout if CRT is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmarsuhail committed Mar 7, 2025
1 parent c0e43dd commit b6d5fa8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,11 @@ public class S3AFileSystem extends FileSystem implements StreamCapabilities,
*/
private boolean fipsEnabled;

/**
* Is CRT enabled?
*/
private boolean isCRTEnabled;

/**
* A cache of files that should be deleted when the FileSystem is closed
* or the JVM is exited.
Expand Down Expand Up @@ -636,6 +641,8 @@ public void initialize(URI name, Configuration originalConf)
// If encryption method is set to CSE-KMS or CSE-CUSTOM then CSE is enabled.
isCSEEnabled = CSEUtils.isCSEEnabled(getS3EncryptionAlgorithm().getMethod());

isCRTEnabled = conf.getBoolean(CRT_CLIENT_ENABLED, DEFAULT_CRT_ENABLED);

isAnalyticsAcceleratorEnabled = StreamIntegration.determineInputStreamType(conf)
.equals(InputStreamType.Analytics);

Expand Down Expand Up @@ -1168,7 +1175,7 @@ private ClientManager createClientManager(URI fsURI, boolean dtEnabled) throws I
.withClientSideEncryptionMaterials(cseMaterials)
.withAnalyticsAcceleratorEnabled(isAnalyticsAcceleratorEnabled)
.withKMSRegion(conf.get(S3_ENCRYPTION_CSE_KMS_REGION))
.withCrtEnabled(conf.getBoolean(CRT_CLIENT_ENABLED, DEFAULT_CRT_ENABLED));
.withCrtEnabled(isCRTEnabled);

// this is where clients and the transfer manager are created on demand.
return createClientManager(clientFactory, unencryptedClientFactory, parameters,
Expand Down Expand Up @@ -1328,6 +1335,7 @@ protected RequestFactory createRequestFactory() {
.withStorageClass(storageClass)
.withMultipartUploadEnabled(isMultipartUploadEnabled)
.withPartUploadTimeout(partUploadTimeout)
.withCRTEnabled(isCRTEnabled)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ public static RetryPolicy.Builder createRetryPolicyBuilder(Configuration conf) {

private static S3CrtProxyConfiguration mapCRTProxyConfiguration(software.amazon.awssdk.http.nio.netty.ProxyConfiguration
proxyConfiguration) {

// If no proxy configurations are set, then proxy configuration can be null.
if (proxyConfiguration == null) {
return null;
}

S3CrtProxyConfiguration.Builder builder = S3CrtProxyConfiguration.builder();

builder.host(proxyConfiguration.host());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ public class RequestFactoryImpl implements RequestFactory {
*/
private final Duration partUploadTimeout;

/**
* Is the S3 CRT client enabled?
*/
private final Boolean isCRTEnabled;

/**
* Constructor.
* @param builder builder with all the configuration.
Expand All @@ -153,6 +158,7 @@ protected RequestFactoryImpl(
this.storageClass = builder.storageClass;
this.isMultipartUploadEnabled = builder.isMultipartUploadEnabled;
this.partUploadTimeout = builder.partUploadTimeout;
this.isCRTEnabled = builder.isCRTEnabled;
}

/**
Expand Down Expand Up @@ -356,7 +362,7 @@ public PutObjectRequest.Builder newPutObjectRequestBuilder(String key,
}

// Set the timeout for object uploads but not directory markers.
if (!isDirectoryMarker) {
if (!isDirectoryMarker && !isCRTEnabled) {
setRequestTimeout(putObjectRequestBuilder, partUploadTimeout);
}

Expand Down Expand Up @@ -725,6 +731,11 @@ public static final class RequestFactoryBuilder {
*/
private boolean isMultipartUploadEnabled = true;

/**
* Is the S3 CRT client enabled?
*/
private boolean isCRTEnabled;

/**
* Timeout for uploading objects/parts.
* This will be set on data put/post operations only.
Expand Down Expand Up @@ -841,6 +852,11 @@ public RequestFactoryBuilder withPartUploadTimeout(final Duration value) {
partUploadTimeout = value;
return this;
}

public RequestFactoryBuilder withCRTEnabled(final boolean value) {
isCRTEnabled = value;
return this;
}
}

/**
Expand Down

0 comments on commit b6d5fa8

Please sign in to comment.