gh-yzou commented on code in PR #1758:
URL: https://github.com/apache/polaris/pull/1758#discussion_r2119876676
##########
service/common/src/main/java/org/apache/polaris/service/config/DefaultConfigurationStore.java:
##########
@@ -51,19 +51,25 @@ public DefaultConfigurationStore(
@Override
public <T> @Nullable T getConfiguration(@Nonnull PolarisCallContext ctx,
String configName) {
- if (!realmContextInstance.isUnsatisfied()) {
- RealmContext realmContext = realmContextInstance.get();
- String realm = realmContext.getRealmIdentifier();
- LOGGER.debug("Get configuration value for {} with realm {}", configName,
realm);
- @SuppressWarnings("unchecked")
- T confgValue =
- (T)
- Optional.ofNullable(realmOverrides.getOrDefault(realm,
Map.of()).get(configName))
- .orElseGet(() -> getDefaultConfiguration(configName));
- return confgValue;
- } else {
- LOGGER.debug(
- "No RealmContext is injected when lookup value for configuration {}
", configName);
+ try {
+ if (realmContextInstance.isResolvable()) {
+ RealmContext realmContext = realmContextInstance.get();
+ String realm = realmContext.getRealmIdentifier();
+ LOGGER.debug("Get configuration value for {} with realm {}",
configName, realm);
+ @SuppressWarnings("unchecked")
+ T confgValue =
+ (T)
+ Optional.ofNullable(realmOverrides.getOrDefault(realm,
Map.of()).get(configName))
+ .orElseGet(() -> getDefaultConfiguration(configName));
+ return confgValue;
+ } else {
+ LOGGER.debug(
+ "No RealmContext is injected when lookup value for configuration
{} ", configName);
+ return getDefaultConfiguration(configName);
+ }
+ } catch (Exception e) {
+ LOGGER.debug("Exception encountered when lookup value for configuration
{}", configName, e);
+ // fall back to the default behavior
return getDefaultConfiguration(configName);
Review Comment:
The originally fix is not correct, we now fixes the back group task
getConfiguration by directly passing the reaml into the function
--
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]