flyrain commented on code in PR #3960:
URL: https://github.com/apache/polaris/pull/3960#discussion_r3017340288
##########
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:
Thanks @Subham-KRLX for continuing to work on this. As I mentioned in the
dev mailing thread, supporting multiple data sources has implications for
schema evolution, Polaris version upgrades, as well as bootstrap and purge
behavior. We should think this through carefully to ensure that existing
behavior remains intact and current users are not impacted. Would you mind
drafting a design doc that covers these aspects? That would allow the Polaris
community to review the proposal and help us move forward.
--
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]