Subham-KRLX commented on code in PR #3960:
URL: https://github.com/apache/polaris/pull/3960#discussion_r2999243423
##########
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:
Agreed I have updated the PR to split the v4 SQL schema into specialized
scripts -metastore, -events, and -metrics. The bootstrap process now executes
only the relevant DDL sub-section for each isolated data source, ensuring they
each only contain the tables necessary for their specific workload.
--
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]