You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "eric-maynard (via GitHub)" <gi...@apache.org> on 2025/06/11 04:04:44 UTC
[PR] Remove PolarisConfiguration.loadConfig (v2) [polaris]
eric-maynard opened a new pull request, #1858:
URL: https://github.com/apache/polaris/pull/1858
`PolarisConfiguration.loadConfig` relies on `CallContext.getCurrentContext` which may not be apparent to callers and often will not work. If the CallContext ThreadLocal hasn't been appropriately set in the calling thread, this method will return invalid results.
This PR proposed to remove the problematic method as part of a series of changes to reduce or remove the usage of ThreadLocal throughout Polaris. This is a rewrite of #1356 now that we have a more CDI-oriented `PolarisConfigurationStore` and an integration between `CallContext` and `PolarisCallContext`.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove PolarisConfiguration.loadConfig (v2) [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #1858:
URL: https://github.com/apache/polaris/pull/1858#discussion_r2140400259
##########
quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java:
##########
@@ -211,8 +211,9 @@ public Map<String, String> getConfigOverrides() {
@Inject PolarisDiagnostics diagServices;
@Inject PolarisEventListener polarisEventListener;
+ protected String realmName;
Review Comment:
`protected` fields are hard to refactor. Non-final shared fields are also hard to reason about (in general). Would you mind adding a `protected` getter for a `private` field instead?
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove PolarisConfiguration.loadConfig (v2) [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #1858:
URL: https://github.com/apache/polaris/pull/1858#discussion_r2140126615
##########
polaris-core/src/test/java/org/apache/polaris/core/storage/BaseStorageIntegrationTest.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.polaris.core.storage;
+
+import org.apache.polaris.core.PolarisCallContext;
+import org.apache.polaris.core.PolarisDiagnostics;
+import org.apache.polaris.core.context.CallContext;
+import org.apache.polaris.core.persistence.BasePersistence;
+import org.mockito.Mockito;
+
+public abstract class BaseStorageIntegrationTest {
+ protected CallContext getCallContext() {
Review Comment:
nit: maybe `newCallContext` or `createCallContext`?
##########
polaris-core/src/test/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheTest.java:
##########
@@ -72,12 +72,16 @@ public StorageCredentialCacheTest() {
new TreeMapTransactionalPersistenceImpl(store, Mockito.mock(), RANDOM_SECRETS);
callCtx = new PolarisCallContext(() -> "testRealm", metaStore, diagServices);
metaStoreManager = Mockito.mock(PolarisMetaStoreManager.class);
- storageCredentialCache = new StorageCredentialCache();
+ storageCredentialCache = getStorageCredentialCache();
+ }
+
+ private StorageCredentialCache getStorageCredentialCache() {
Review Comment:
nit: maybe `newStorageCredentialCache`?
##########
polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogEntity.java:
##########
@@ -304,19 +301,6 @@ public Builder setStorageConfigurationInfo(
return this;
}
- /** Validate the number of allowed locations not exceeding the max value. */
- private void validateMaxAllowedLocations(Collection<String> allowedLocations) {
Review Comment:
Don't we need this validation anymore? Or is it being done elsewhere?
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove PolarisConfiguration.loadConfig (v2) [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #1858:
URL: https://github.com/apache/polaris/pull/1858#discussion_r2140516770
##########
polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogEntity.java:
##########
@@ -304,19 +301,6 @@ public Builder setStorageConfigurationInfo(
return this;
}
- /** Validate the number of allowed locations not exceeding the max value. */
- private void validateMaxAllowedLocations(Collection<String> allowedLocations) {
Review Comment:
This is a temporary `BehaviorChangeConfiguration` (the default is no validation) so I thought this might be a good time to remove it. but if you think we'd better separate out that change, I can try to re-add the check. Unfortunately, there's not a great narrow waist for adding a `PolarisCallContext` to an entity.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove PolarisConfiguration.loadConfig (v2) [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #1858:
URL: https://github.com/apache/polaris/pull/1858#discussion_r2140893618
##########
polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogEntity.java:
##########
@@ -304,19 +301,6 @@ public Builder setStorageConfigurationInfo(
return this;
}
- /** Validate the number of allowed locations not exceeding the max value. */
- private void validateMaxAllowedLocations(Collection<String> allowedLocations) {
Review Comment:
I undid the change for now and piped a CallContext in, we can always remove it separately. Thanks for flagging this
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove PolarisConfiguration.loadConfig (v2) [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #1858:
URL: https://github.com/apache/polaris/pull/1858#discussion_r2140528353
##########
polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogEntity.java:
##########
@@ -304,19 +301,6 @@ public Builder setStorageConfigurationInfo(
return this;
}
- /** Validate the number of allowed locations not exceeding the max value. */
- private void validateMaxAllowedLocations(Collection<String> allowedLocations) {
Review Comment:
Ah right, it's a `BehaviorChangeConfiguration`. OK to remove this validation then.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove PolarisConfiguration.loadConfig (v2) [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #1858:
URL: https://github.com/apache/polaris/pull/1858#discussion_r2140390587
##########
polaris-core/src/test/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheTest.java:
##########
@@ -72,12 +72,16 @@ public StorageCredentialCacheTest() {
new TreeMapTransactionalPersistenceImpl(store, Mockito.mock(), RANDOM_SECRETS);
callCtx = new PolarisCallContext(() -> "testRealm", metaStore, diagServices);
metaStoreManager = Mockito.mock(PolarisMetaStoreManager.class);
- storageCredentialCache = new StorageCredentialCache();
+ storageCredentialCache = getStorageCredentialCache();
+ }
+
+ private StorageCredentialCache getStorageCredentialCache() {
Review Comment:
I agree "new" is more intuitive in this context.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove PolarisConfiguration.loadConfig (v2) [polaris]
Posted by "singhpk234 (via GitHub)" <gi...@apache.org>.
singhpk234 merged PR #1858:
URL: https://github.com/apache/polaris/pull/1858
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org