Skip to content

Fix loss loss of cross region bucket read config for s3 client in the v2 migration#19180

Merged
gianm merged 3 commits intoapache:masterfrom
capistrant:s3-cross-region
Mar 19, 2026
Merged

Fix loss loss of cross region bucket read config for s3 client in the v2 migration#19180
gianm merged 3 commits intoapache:masterfrom
capistrant:s3-cross-region

Conversation

@capistrant
Copy link
Contributor

@capistrant capistrant commented Mar 19, 2026

Description

  • Wires up AWS SDK v2 crossRegionAccessEnabled on the S3 client builders, enabling transparent cross-region bucket access.
  • Introduces a new druid.s3.crossRegionAccessEnabled configuration property to replace the legacy druid.s3.forceGlobalBucketAccessEnabled.
  • Deprecates forceGlobalBucketAccessEnabled but continues to honor it if set + the new config is not set. This is so existing operator configurations keep working without disruption. A deprecation warning is logged at startup when the legacy property is detected.
  • Updates docs and JSON examples to reference the new property.

Release note

note: this should go with the s3 sdk upgrade release note/upgrade note section. this is not a breaking change for Druid 37, but eventually it could be if we drop the legacy config in a future release.

For operators: If you currently set druid.s3.forceGlobalBucketAccessEnabled in your runtime properties, please migrate to druid.s3.crossRegionAccessEnabled at your earliest convenience. The legacy property will continue to work
and takes precedence if set, but it will be removed in a future release.


Key changed/added classes in this PR
  • AwsClientConig

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@capistrant
Copy link
Contributor Author

Adjacent to #19178. Needed for D37

@capistrant capistrant added this to the 37.0.0 milestone Mar 19, 2026
public void testDefaultCrossRegionAccessEnabled() throws Exception
{
AWSClientConfig config = MAPPER.readValue("{}", AWSClientConfig.class);
Assertions.assertNull(config.isForceGlobalBucketAccessEnabled());

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
AWSClientConfig.isForceGlobalBucketAccessEnabled
should be avoided because it has been deprecated.
public void testCrossRegionAccessEnabledExplicitlySet() throws Exception
{
AWSClientConfig config = MAPPER.readValue("{\"crossRegionAccessEnabled\": true}", AWSClientConfig.class);
Assertions.assertNull(config.isForceGlobalBucketAccessEnabled());

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
AWSClientConfig.isForceGlobalBucketAccessEnabled
should be avoided because it has been deprecated.
"{\"crossRegionAccessEnabled\": true}",
AWSClientConfig.class
);
Assertions.assertNull(config.isForceGlobalBucketAccessEnabled());

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
AWSClientConfig.isForceGlobalBucketAccessEnabled
should be avoided because it has been deprecated.
S3StorageConfig storageConfig
)
{
if (clientConfig.isForceGlobalBucketAccessEnabled() != null) {

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
AWSClientConfig.isForceGlobalBucketAccessEnabled
should be avoided because it has been deprecated.

public boolean isCrossRegionAccessEnabled()
{
if (forceGlobalBucketAccessEnabled != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crossRegionAccessEnabled, if set, should take precedence over forceGlobalBucketAccessEnabled because the latter is deprecated.

"protocol='" + protocol + '\'' +
", disableChunkedEncoding=" + disableChunkedEncoding +
", enablePathStyleAccess=" + enablePathStyleAccess +
", forceGlobalBucketAccessEnabled=" + forceGlobalBucketAccessEnabled +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should include forceGlobalBucketAccessEnabled, even though it's deprecated it still exists for now.

|`druid.s3.enablePathStyleAccess`|Enables path style access. See [AWS document](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3Builder.html#enablePathStyleAccess--) for details.|false|
|`druid.s3.forceGlobalBucketAccessEnabled`|Enables global bucket access. See [AWS document](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3Builder.html#setForceGlobalBucketAccessEnabled-java.lang.Boolean-) for details.|false|
|`druid.s3.crossRegionAccessEnabled`|Enables cross-region access for S3 requests. When enabled, the S3 client automatically detects the correct region for a bucket on first access and caches it for subsequent requests.|false|
|`druid.s3.forceGlobalBucketAccessEnabled`|**Deprecated.** Use `druid.s3.crossRegionAccessEnabled` instead. If explicitly set, this takes precedence over `crossRegionAccessEnabled`.|null|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"this takes precedence" <- mentioned this elsewhere but IMO these should be flipped.

@capistrant
Copy link
Contributor Author

@gianm ty for pointing out the backwards logic. I think the latest will meet the desired order

@gianm gianm merged commit d159e38 into apache:master Mar 19, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants