Samrat002 commented on code in PR #27970:
URL: https://github.com/apache/flink/pull/27970#discussion_r3110623978
##########
flink-filesystems/flink-s3-fs-native/src/test/java/org/apache/flink/fs/s3native/NativeS3BulkCopyHelperTest.java:
##########
@@ -105,4 +110,42 @@ void testExtractKeyVeryLongPath() {
path.append("file.txt");
assertThat(helper.extractKey("s3://bucket/" +
path)).isEqualTo(path.toString());
}
+
+ @Test
+ void testConnectionPoolExhaustedDetection() {
+ assertThat(
+ NativeS3BulkCopyHelper.isConnectionPoolExhausted(
+ SdkClientException.builder()
+ .message(
+ "Unable to execute HTTP
request: "
+ + "Acquire operation
took longer than the configured maximum time.")
+ .build()))
+ .isTrue();
+ assertThat(
+ NativeS3BulkCopyHelper.isConnectionPoolExhausted(
+ SdkClientException.builder()
+ .message("Unable to execute HTTP
request")
+ .cause(
+ new RuntimeException(
+ "channel acquisition
failed",
+ new
java.util.concurrent.TimeoutException(
Review Comment:
To clarify the design, we don't wait-and-retry on pool exhaustion. The
behaviour is fail-fast. when the SDK's connection acquire timeout expires, we
catch it and throw an actionable IOException that tells the operator exactly
which config keys to adjust (`s3.bulk-copy.max-concurrent /
s3.connection.max`).
There is no recovery path within a single copyFiles invocation. Flink's
checkpoint restore framework handles the retry at a higher level.
The primary defence is the clamping logic, which prevents the most common
exhaustion scenario upfront. The `isConnectionPoolExhausted` detection is
defence-in-depth for edge cases where S3TransferManager's multipart downloads
consume multiple HTTP connections per file (files > 8MB are split into parts,
each part = separate connection), which can exceed the pool even after
clamping.
A test simulating real pool exhaustion → recovery would require standing up
a real Netty connection pool against an S3-compatible endpoint and inducing
timing-dependent acquire timeouts, which will be inherently flaky in CI. The
detection logic is covered by the message-matching unit test, which validates
that we correctly identify the SDK's characteristic "Acquire operation took
longer than" message in both direct and nested causal chains.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]