adutra commented on PR #1758:
URL: https://github.com/apache/polaris/pull/1758#issuecomment-2931669320

   @gh-yzou the culprit is here:
   
   
https://github.com/apache/polaris/blob/7f97a955ae9e59f89e1c80a81ecc348ea6fa7797/service/common/src/main/java/org/apache/polaris/service/config/DefaultConfigurationStore.java#L55
   
   I don't know why this `realmContextInstance` has been added, but this cannot 
work when the call stack comes from an executor task.
   
   The proper way to pass the realm context here would be as a method 
parameter, for example by passing `CallContext` instead of `PolarisCallContext`:
   
   ```java
     public <T> @Nullable T getConfiguration(@Nonnull CallContext ctx, String 
configName) {
       RealmContext realmContext = ctx.getRealmContext();
       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;
     }
   ```
   
   As much as I would prefer to stop using `CallContext` I think here it 
actually makes sense to use it. At least until we get proper context 
propagation 100% working in task executor.


-- 
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-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to