dimas-b commented on code in PR #3960:
URL: https://github.com/apache/polaris/pull/3960#discussion_r2991336294


##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java:
##########
@@ -154,32 +167,39 @@ public synchronized Map<String, PrincipalSecretsResult> 
bootstrapRealms(
     for (String realm : bootstrapOptions.realms()) {
       RealmContext realmContext = () -> realm;
       if (!metaStoreManagerMap.containsKey(realm)) {
-        DatasourceOperations datasourceOperations = getDatasourceOperations();
-        int currentSchemaVersion =
-            JdbcBasePersistenceImpl.loadSchemaVersion(datasourceOperations, 
true);
+        DatasourceOperations metastoreOps =
+            getDatasourceOperations(realmContext, 
DataSourceResolver.StoreType.METASTORE);
+        DatasourceOperations metricsOps =
+            getDatasourceOperations(realmContext, 
DataSourceResolver.StoreType.METRICS);
+        DatasourceOperations eventOps =
+            getDatasourceOperations(realmContext, 
DataSourceResolver.StoreType.EVENTS);
+
+        int currentSchemaVersion = 
JdbcBasePersistenceImpl.loadSchemaVersion(metastoreOps, true);
         int requestedSchemaVersion = 
JdbcBootstrapUtils.getRequestedSchemaVersion(bootstrapOptions);
         int effectiveSchemaVersion =
             JdbcBootstrapUtils.getRealmBootstrapSchemaVersion(
-                datasourceOperations.getDatabaseType(),
+                metastoreOps.getDatabaseType(),
                 currentSchemaVersion,
                 requestedSchemaVersion,
-                
JdbcBasePersistenceImpl.entityTableExists(datasourceOperations));
+                JdbcBasePersistenceImpl.entityTableExists(metastoreOps));
         LOGGER.info(
             "Effective schema version: {} for bootstrapping realm: {}",
             effectiveSchemaVersion,
             realm);
+
         try {
-          // Run the set-up script to create the tables.
-          datasourceOperations.executeScript(
-              datasourceOperations
-                  .getDatabaseType()
-                  .openInitScriptResource(effectiveSchemaVersion));
+          // Run the set-up script to create the tables on all data sources.
+          metastoreOps.executeScript(
+              
metastoreOps.getDatabaseType().openInitScriptResource(effectiveSchemaVersion));
+          metricsOps.executeScript(
+              
metricsOps.getDatabaseType().openInitScriptResource(effectiveSchemaVersion));
+          eventOps.executeScript(
+              
eventOps.getDatabaseType().openInitScriptResource(effectiveSchemaVersion));

Review Comment:
   I believe in each of those bootstrap calls should execute a sub-section of 
the DDL relevant to the sub-system (metastore, metrics, events).
   
   @flyrain @singhpk234 : WDYT?



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