flyrain commented on code in PR #4054:
URL: https://github.com/apache/polaris/pull/4054#discussion_r3023821897


##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java:
##########
@@ -153,8 +153,7 @@ public synchronized Map<String, PrincipalSecretsResult> 
bootstrapRealms(
 
     for (String realm : bootstrapOptions.realms()) {
       RealmContext realmContext = () -> realm;
-      if (!metaStoreManagerMap.containsKey(realm)) {
-        DatasourceOperations datasourceOperations = getDatasourceOperations();
+      if (!verifiedRealms.contains(realm)) {

Review Comment:
   This check doesn’t make much sense here. The bootstrap is invoked by a CLI 
tool, so relying on in-memory state isn’t meaningful. Instead, we should make 
the process idempotent and avoid re-bootstrapping an already initialized realm. 
That logic should be based on the actual DB state, for example whether the root 
principal already exists, rather than an in-memory cache that only lives for 
the duration of the process.
   
   Since the CLI tool is short-lived anyway, I’d suggest reusing 
`checkPolarisServiceBootstrappedForRealm()` here. We could decide whether split 
it to two methods to strip out `verifiedRealms.add(realmId);` but that's a 
minor point.



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