You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "Subham-KRLX (via GitHub)" <gi...@apache.org> on 2026/04/01 08:20:20 UTC
Re: [PR] Introduce DataSourceResolver for multi-datasource support in JDBC per… [polaris]
Subham-KRLX commented on code in PR #3960:
URL: https://github.com/apache/polaris/pull/3960#discussion_r3020548194
##########
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 have addressed your feedback by drafting a formal design document in docs/metastores/jdbc-multi-datasource.md that covers schema evolution, upgrades, bootstrap, and purge behavior. Along with the documentation I have refined the purge implementation to ensure complete cleanup across isolated data sources and resolved the rat task configuration issue to fix the build blockers. I will share the design doc on the community mailing list today for further review.
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org