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


##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/models/ModelEntity.java:
##########
@@ -195,7 +236,7 @@ public PolarisBaseEntity fromResultSet(ResultSet r) throws 
SQLException {
             // JSONB: use getString(), not getObject().
             .internalProperties(r.getString("internal_properties"))
             .grantRecordsVersion(r.getObject("grant_records_version", 
Integer.class))
-            .locationWithoutScheme(r.getString("location_without_scheme"))
+            .locationWithoutScheme(this.schemaVersion >= 2 ? 
locationWithoutScheme : null)

Review Comment:
   Why are we not getting `locationWithoutScheme` from `r`?



##########
persistence/relational-jdbc/src/main/resources/h2/schema-v0.sql:
##########


Review Comment:
   Why add a v0 schema? Who would want to run this DDL script?



##########
persistence/relational-jdbc/src/test/java/org/apache/polaris/persistence/relational/jdbc/AtomicMetastoreManagerWithJdbcBasePersistenceImplV1SchemaTest.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.polaris.persistence.relational.jdbc;
+
+public class AtomicMetastoreManagerWithJdbcBasePersistenceImplV1SchemaTest
+    extends AtomicMetastoreManagerWithJdbcBasePersistenceImplTest {
+  @Override
+  public int schemaVersion() {

Review Comment:
   (optional) this may be more convenient to implement as `@Nested` tests under 
the JUnit5 framework (less top-level classes).



##########
runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java:
##########
@@ -302,4 +302,36 @@ public ProductionReadinessCheck 
checkInsecureStorageSettings(
         ? ProductionReadinessCheck.OK
         : ProductionReadinessCheck.of(errors.toArray(new Error[0]));
   }
+
+  @Produces
+  public ProductionReadinessCheck checkOverlappingSiblingCheckSettings(
+      FeaturesConfiguration featureConfiguration) {
+    var optimizedSiblingCheck = FeatureConfiguration.OPTIMIZED_SIBLING_CHECK;
+    var errors = new ArrayList<Error>();
+    if 
(Boolean.parseBoolean(featureConfiguration.defaults().get(optimizedSiblingCheck.key())))
 {
+      errors.add(
+          Error.ofSevere(
+              "This setting is not recommended for production environments as 
it may lead to incorrect behavior, due to missing data for 
location_without_scheme column in case of migrating from older Polaris 
versions."

Review Comment:
   Can we detect upgrades and only flag this error in upgraded environments?



##########
runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java:
##########
@@ -302,4 +302,36 @@ public ProductionReadinessCheck 
checkInsecureStorageSettings(
         ? ProductionReadinessCheck.OK
         : ProductionReadinessCheck.of(errors.toArray(new Error[0]));
   }
+
+  @Produces
+  public ProductionReadinessCheck checkOverlappingSiblingCheckSettings(
+      FeaturesConfiguration featureConfiguration) {
+    var optimizedSiblingCheck = FeatureConfiguration.OPTIMIZED_SIBLING_CHECK;
+    var errors = new ArrayList<Error>();
+    if 
(Boolean.parseBoolean(featureConfiguration.defaults().get(optimizedSiblingCheck.key())))
 {

Review Comment:
   Any module can produce a `ProductionReadinessCheck`, I believe. If we did it 
in the JDBC persistence, would it be easier to access schema details?
   
   I'd suggest checking for the some values in the new columns and assuming the 
values are correct if present. It should catch most common upgrade scenarios 
and also allow backfilling the values manually. 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