adnanhemani commented on code in PR #1765:
URL: https://github.com/apache/polaris/pull/1765#discussion_r2151078339


##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/LocalPolarisMetaStoreManagerFactory.java:
##########
@@ -100,7 +101,12 @@ private void initializeForRealm(
     final StoreType backingStore = createBackingStore(diagnostics);
     sessionSupplierMap.put(
         realmContext.getRealmIdentifier(),
-        () -> createMetaStoreSession(backingStore, realmContext, 
rootCredentialsSet, diagnostics));
+        new CachedSupplier<>(

Review Comment:
   Got it, so the way I see it is we have really 2 options to fix this issue:
   
   1. Keep this approach and change the semantics for the 
`TransactionalPersistence` interface to be stateless (either now or in the 
future). OR
   2. Take the approach to materialize the Realm ID and create a new 
`realmContext` to pass into the supplier that breaks the dependency on the 
`realmContext` that originally came from the function signature. While this is 
a less invasive change, I do not have an easy way to test this behavior.
   
   I'm leaning towards option 2 simply because it is less invasive - but is 
everyone else okay without there being hard testing for this few-line change? 
It would look something like this:
   
   
   ```
   private void initializeForRealm(
         RealmContext realmContext, RootCredentialsSet rootCredentialsSet) {
       final StoreType backingStore = createBackingStore(diagnostics);
       String materializedRealmId = realmContext.getRealmIdentifier();
       RealmContext materializedRealmContext = () -> materializedRealmId;
       sessionSupplierMap.put(
           realmContext.getRealmIdentifier(),
           () -> createMetaStoreSession(backingStore, materializedRealmContext, 
rootCredentialsSet, diagnostics));
   
       PolarisMetaStoreManager metaStoreManager = createNewMetaStoreManager();
       metaStoreManagerMap.put(realmContext.getRealmIdentifier(), 
metaStoreManager);
     }
   ```



-- 
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]

Reply via email to