singhpk234 commented on code in PR #2762:
URL: https://github.com/apache/polaris/pull/2762#discussion_r2409295845


##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java:
##########
@@ -154,6 +159,19 @@ public synchronized Map<String, PrincipalSecretsResult> 
bootstrapRealms(
       RealmContext realmContext = () -> realm;
       if (!metaStoreManagerMap.containsKey(realm)) {
         DatasourceOperations datasourceOperations = getDatasourceOperations();
+        int schemaVersion =
+            JdbcBasePersistenceImpl.loadSchemaVersion(
+                datasourceOperations,
+                configurationStore.getConfiguration(
+                    realmContext, 
BehaviorChangeConfiguration.SCHEMA_VERSION_FALL_BACK_ON_DNE));
+        // skip validation if no schema is specified.
+        int requestedSchemaVersion = getSchemaVersion(bootstrapOptions);
+        Preconditions.checkState(
+            (requestedSchemaVersion == schemaVersion)
+                || (schemaVersion == 0 || requestedSchemaVersion == -1),

Review Comment:
   > In case schemaVersion is 0, I think we have to make sure 
requestedSchemaVersion is 1.
   
   schemaVersion 0 will be 2 cases, 
   - 1.0 bootstraped realms they are at v1, so i guess they should stay at v1
   - no bootstraped realms doesn't matter which version they go so in this case 
we can go to requestedSchemaVersion
   
   requestSchema -1 : 
   - already bootstraped realms schema should stay currentSchema
   - no realms bootstrapped doesn't matter which version they go so in this 
case we can go to most recent
   
   Nice catch on the cases i think we just need to know if we ever ran 
bootstrap if yes, then 
   - schemaVersion 0 means v1
   - requestSchema -1 means current schema
   



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