You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "capistrant (via GitHub)" <gi...@apache.org> on 2026/03/19 15:09:03 UTC
[PR] Fix loss loss of cross region bucket read config for s3 client in the v2 migration (druid)
capistrant opened a new pull request, #19180:
URL: https://github.com/apache/druid/pull/19180
<!-- Thanks for trying to help us make Apache Druid be the best it can be! Please fill out as much of the following information as is possible (where relevant, and remove it when irrelevant) to help make the intention and scope of this PR clear in order to ease review. -->
<!-- Please read the doc for contribution (https://github.com/apache/druid/blob/master/CONTRIBUTING.md) before making this PR. Also, once you open a PR, please _avoid using force pushes and rebasing_ since these make it difficult for reviewers to see what you've changed in response to their reviews. See [the 'If your pull request shows conflicts with master' section](https://github.com/apache/druid/blob/master/CONTRIBUTING.md#if-your-pull-request-shows-conflicts-with-master) for more details. -->
<!-- Replace XXXX with the id of the issue fixed in this PR. Remove this section if there is no corresponding issue. Don't reference the issue in the title of this pull-request. -->
<!-- If you are a committer, follow the PR action item checklist for committers:
https://github.com/apache/druid/blob/master/dev/committer-instructions.md#pr-and-issue-action-item-checklist-for-committers. -->
### Description
<!-- Describe the goal of this PR, what problem are you fixing. If there is a corresponding issue (referenced above), it's not necessary to repeat the description here, however, you may choose to keep one summary sentence. -->
<!-- Describe your patch: what did you change in code? How did you fix the problem? -->
<!-- If there are several relatively logically separate changes in this PR, create a mini-section for each of them. For example: -->
- 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 (default false) to replace the legacy druid.s3.forceGlobalBucketAccessEnabled.
- Deprecates forceGlobalBucketAccessEnabled but continues to honor it if explicitly set, 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.
<!--
In each section, please describe design decisions made, including:
- Choice of algorithms
- Behavioral aspects. What configuration values are acceptable? How are corner cases and error conditions handled, such as when there are insufficient resources?
- Class organization and design (how the logic is split between classes, inheritance, composition, design patterns)
- Method organization and design (how the logic is split between methods, parameters and return types)
- Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
-->
<!-- It's good to describe an alternative design (or mention an alternative name) for every design (or naming) decision point and compare the alternatives with the designs that you've implemented (or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
<!-- If there was a discussion of the design of the feature implemented in this PR elsewhere (e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list), link to that discussion from this PR description and explain what have changed in your final design compared to your original proposal or the consensus version in the end of the discussion. If something hasn't changed since the original discussion, you can omit a detailed discussion of those aspects of the design here, perhaps apart from brief mentioning for the sake of readability of this PR description. -->
<!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
#### Release note
<!-- Give your best effort to summarize your changes in a couple of sentences aimed toward Druid users.
If your change doesn't have end user impact, you can skip this section.
For tips about how to write a good release note, see [Release notes](https://github.com/apache/druid/blob/master/CONTRIBUTING.md#release-notes).
-->
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.
<hr>
##### Key changed/added classes in this PR
* `AwsClientConig`
<hr>
<!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist below are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
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](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] 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](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix loss loss of cross region bucket read config for s3 client in the v2 migration (druid)
Posted by "capistrant (via GitHub)" <gi...@apache.org>.
capistrant commented on PR #19180:
URL: https://github.com/apache/druid/pull/19180#issuecomment-4091520911
@gianm ty for pointing out the backwards logic. I think the latest will meet the desired order
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix loss loss of cross region bucket read config for s3 client in the v2 migration (druid)
Posted by "gianm (via GitHub)" <gi...@apache.org>.
gianm commented on code in PR #19180:
URL: https://github.com/apache/druid/pull/19180#discussion_r2961163127
##########
cloud/aws-common/src/main/java/org/apache/druid/common/aws/AWSClientConfig.java:
##########
@@ -67,11 +77,24 @@ public boolean isEnablePathStyleAccess()
return enablePathStyleAccess;
}
- public boolean isForceGlobalBucketAccessEnabled()
+ /**
+ * @deprecated Use {@link #isCrossRegionAccessEnabled()} instead.
+ */
+ @Deprecated
+ @Nullable
+ public Boolean isForceGlobalBucketAccessEnabled()
{
return forceGlobalBucketAccessEnabled;
}
+ public boolean isCrossRegionAccessEnabled()
+ {
+ if (forceGlobalBucketAccessEnabled != null) {
Review Comment:
`crossRegionAccessEnabled`, if set, should take precedence over `forceGlobalBucketAccessEnabled` because the latter is deprecated.
##########
docs/development/extensions-core/s3.md:
##########
@@ -129,7 +129,8 @@ For example, to set the region to 'us-east-1' through system properties:
|`druid.s3.protocol`|Communication protocol type to use when sending requests to AWS. `http` or `https` can be used. This configuration would be ignored if `druid.s3.endpoint.url` is filled with a URL with a different protocol.|`https`|
|`druid.s3.disableChunkedEncoding`|Disables chunked encoding. See [AWS document](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3Builder.html#disableChunkedEncoding--) for details.|false|
|`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|
Review Comment:
"this takes precedence" <- mentioned this elsewhere but IMO these should be flipped.
##########
cloud/aws-common/src/main/java/org/apache/druid/common/aws/AWSClientConfig.java:
##########
@@ -94,7 +117,7 @@ public String toString()
"protocol='" + protocol + '\'' +
", disableChunkedEncoding=" + disableChunkedEncoding +
", enablePathStyleAccess=" + enablePathStyleAccess +
- ", forceGlobalBucketAccessEnabled=" + forceGlobalBucketAccessEnabled +
Review Comment:
Should include `forceGlobalBucketAccessEnabled`, even though it's deprecated it still exists for now.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix loss loss of cross region bucket read config for s3 client in the v2 migration (druid)
Posted by "capistrant (via GitHub)" <gi...@apache.org>.
capistrant commented on PR #19180:
URL: https://github.com/apache/druid/pull/19180#issuecomment-4090818799
Adjacent to https://github.com/apache/druid/pull/19178. Needed for D37
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix loss loss of cross region bucket read config for s3 client in the v2 migration (druid)
Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #19180:
URL: https://github.com/apache/druid/pull/19180#discussion_r2960910672
##########
cloud/aws-common/src/test/java/org/apache/druid/common/aws/AWSClientConfigTest.java:
##########
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.common.aws;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class AWSClientConfigTest
+{
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ @Test
+ public void testDefaultCrossRegionAccessEnabled() throws Exception
+ {
+ AWSClientConfig config = MAPPER.readValue("{}", AWSClientConfig.class);
+ Assertions.assertNull(config.isForceGlobalBucketAccessEnabled());
+ Assertions.assertFalse(config.isCrossRegionAccessEnabled());
+ }
+
+ @Test
+ public void testCrossRegionAccessEnabledExplicitlySet() throws Exception
+ {
+ AWSClientConfig config = MAPPER.readValue("{\"crossRegionAccessEnabled\": true}", AWSClientConfig.class);
+ Assertions.assertNull(config.isForceGlobalBucketAccessEnabled());
+ Assertions.assertTrue(config.isCrossRegionAccessEnabled());
+ }
+
+ @Test
+ public void testDeprecatedForceGlobalBucketAccessTrueOverridesCrossRegion() throws Exception
+ {
+ AWSClientConfig config = MAPPER.readValue(
+ "{\"forceGlobalBucketAccessEnabled\": true, \"crossRegionAccessEnabled\": false}",
+ AWSClientConfig.class
+ );
+ Assertions.assertTrue(config.isCrossRegionAccessEnabled());
+ }
+
+ @Test
+ public void testDeprecatedForceGlobalBucketAccessFalseOverridesCrossRegion() throws Exception
+ {
+ AWSClientConfig config = MAPPER.readValue(
+ "{\"forceGlobalBucketAccessEnabled\": false, \"crossRegionAccessEnabled\": true}",
+ AWSClientConfig.class
+ );
+ Assertions.assertFalse(config.isCrossRegionAccessEnabled());
+ }
+
+ @Test
+ public void testDeprecatedForceGlobalBucketAccessAloneTrue() throws Exception
+ {
+ AWSClientConfig config = MAPPER.readValue(
+ "{\"forceGlobalBucketAccessEnabled\": true}",
+ AWSClientConfig.class
+ );
+ Assertions.assertTrue(config.isCrossRegionAccessEnabled());
+ }
+
+ @Test
+ public void testDeprecatedNotSetFallsThroughToCrossRegion() throws Exception
+ {
+ AWSClientConfig config = MAPPER.readValue(
+ "{\"crossRegionAccessEnabled\": true}",
+ AWSClientConfig.class
+ );
+ Assertions.assertNull(config.isForceGlobalBucketAccessEnabled());
Review Comment:
## Deprecated method or constructor invocation
Invoking [AWSClientConfig.isForceGlobalBucketAccessEnabled](1) should be avoided because it has been deprecated.
[Show more details](https://github.com/apache/druid/security/code-scanning/10905)
##########
cloud/aws-common/src/test/java/org/apache/druid/common/aws/AWSClientConfigTest.java:
##########
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.common.aws;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class AWSClientConfigTest
+{
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ @Test
+ public void testDefaultCrossRegionAccessEnabled() throws Exception
+ {
+ AWSClientConfig config = MAPPER.readValue("{}", AWSClientConfig.class);
+ Assertions.assertNull(config.isForceGlobalBucketAccessEnabled());
Review Comment:
## Deprecated method or constructor invocation
Invoking [AWSClientConfig.isForceGlobalBucketAccessEnabled](1) should be avoided because it has been deprecated.
[Show more details](https://github.com/apache/druid/security/code-scanning/10903)
##########
extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3StorageDruidModule.java:
##########
@@ -138,6 +138,13 @@
S3StorageConfig storageConfig
)
{
+ if (clientConfig.isForceGlobalBucketAccessEnabled() != null) {
Review Comment:
## Deprecated method or constructor invocation
Invoking [AWSClientConfig.isForceGlobalBucketAccessEnabled](1) should be avoided because it has been deprecated.
[Show more details](https://github.com/apache/druid/security/code-scanning/10906)
##########
cloud/aws-common/src/test/java/org/apache/druid/common/aws/AWSClientConfigTest.java:
##########
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.common.aws;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class AWSClientConfigTest
+{
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ @Test
+ public void testDefaultCrossRegionAccessEnabled() throws Exception
+ {
+ AWSClientConfig config = MAPPER.readValue("{}", AWSClientConfig.class);
+ Assertions.assertNull(config.isForceGlobalBucketAccessEnabled());
+ Assertions.assertFalse(config.isCrossRegionAccessEnabled());
+ }
+
+ @Test
+ public void testCrossRegionAccessEnabledExplicitlySet() throws Exception
+ {
+ AWSClientConfig config = MAPPER.readValue("{\"crossRegionAccessEnabled\": true}", AWSClientConfig.class);
+ Assertions.assertNull(config.isForceGlobalBucketAccessEnabled());
Review Comment:
## Deprecated method or constructor invocation
Invoking [AWSClientConfig.isForceGlobalBucketAccessEnabled](1) should be avoided because it has been deprecated.
[Show more details](https://github.com/apache/druid/security/code-scanning/10904)
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix loss loss of cross region bucket read config for s3 client in the v2 migration (druid)
Posted by "gianm (via GitHub)" <gi...@apache.org>.
gianm merged PR #19180:
URL: https://github.com/apache/druid/pull/19180
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org