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


##########
extension/persistence/relational-jdbc/src/main/java/org/apache/polaris/extension/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java:
##########
@@ -106,12 +107,12 @@ private void initializeForRealm(
   }
 
   private DatasourceOperations getDatasourceOperations(boolean isBootstrap) {
-    DatasourceOperations databaseOperations = new 
DatasourceOperations(dataSource);
+    DatasourceOperations databaseOperations = new 
DatasourceOperations(dataSource.get());
     if (isBootstrap) {
       // TODO: see if we need to take script from Quarkus or can we just
       // use the script committed in the repo.
       try {
-        
databaseOperations.executeScript("scripts/postgres/schema-v1-postgres.sql");
+        databaseOperations.executeScript("postgres/schema-v1-postgresql.sql");

Review Comment:
   Ideally the script name should be derived from the DataSource config. Let's 
inject the DataSource "type" (enum) along with the `DataSource` value and map 
it to scripts here.



##########
extension/persistence/relational-jdbc/src/main/resources/postgres/schema-v1-postgresql.sql:
##########
@@ -15,16 +15,12 @@
 -- KIND, either express or implied.  See the License for the
 -- specific language governing permissions and limitations
 -- under the License.
---
 
--- Note: Database and schema creation is not included in this script. Please 
create the database and
--- schema before running this script. for example in psql:
--- CREATE DATABASE polaris_db;
--- \c polaris_db
--- CREATE SCHEMA polaris_schema;
--- set search_path to polaris_schema;
+CREATE SCHEMA IF NOT EXISTS POLARIS_SCHEMA;
+SET search_path TO POLARIS_SCHEMA;

Review Comment:
   `search_path` may be required on all connections (even when the schema 
already exists), right?



##########
extension/persistence/relational-jdbc/src/main/java/org/apache/polaris/extension/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java:
##########
@@ -45,14 +46,15 @@ public class JdbcMetaStoreManagerFactory extends 
LocalPolarisMetaStoreManagerFac
 
   // TODO: Pending discussion of if we should have one Database per realm or 1 
schema per realm
   // or realm should be a primary key on all the tables.
-  @Inject DataSource dataSource;
+  @Inject Instance<DataSource> dataSource;

Review Comment:
   Let's revisit this as discussed offline. If the JDBC MetaStore factory is 
not selected by the `type` config, it should not affect CDI injections (should 
not fail startup). If JDBC is selected, then the DataSource should be 
configured. 
   
   In any case, if we have to use `Instance`, it should not be handled here, 
but in Quarkus-specific code (producers).



##########
quarkus/service/src/testFixtures/java/org/apache/polaris/service/quarkus/it/PostgresRelationalJdbcLifeCycleManagement.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * 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.service.quarkus.it;
+
+import io.quarkus.test.common.DevServicesContext;
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import java.util.Map;
+import org.testcontainers.containers.PostgreSQLContainer;
+import org.testcontainers.utility.DockerImageName;
+
+public class PostgresRelationalJdbcLifeCycleManagement

Review Comment:
   Isn't this class duplicated in the admin tool? Could you use one shared 
class?



##########
extension/persistence/relational-jdbc/build.gradle.kts:
##########
@@ -17,7 +17,10 @@
  * under the License.
  */
 
-plugins { id("polaris-server") }
+plugins {
+  id("polaris-server")
+  alias(libs.plugins.jandex)

Review Comment:
   nit: don't all modules get jandex by default?



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