jbonofre commented on code in PR #4984:
URL: https://github.com/apache/polaris/pull/4984#discussion_r3654503613


##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java:
##########
@@ -95,7 +96,35 @@ protected JdbcMetaStoreManagerFactory() {}
   @ApplicationScoped
   static DatasourceOperations produceDatasourceOperations(
       Instance<DataSource> dataSource, RelationalJdbcConfiguration 
relationalJdbcConfiguration) {
-    return new DatasourceOperations(dataSource.get(), 
relationalJdbcConfiguration);
+    Optional<DataSource> polarisDataSource =
+        JdbcDataSourceFactory.create(relationalJdbcConfiguration);
+    return polarisDataSource
+        .map(ds -> createOwnedDatasourceOperations(ds, 
relationalJdbcConfiguration))
+        .orElseGet(() -> new DatasourceOperations(dataSource.get(), 
relationalJdbcConfiguration));
+  }
+
+  static void closeDatasourceOperations(@Disposes DatasourceOperations 
datasourceOperations) {

Review Comment:
   nit: The producer here is `static`, so a `static` disposer is consistent. I 
have to check if Quarkus ArC actually invokes a `static @Disposes` method on 
shutdown. This is the  mechanism that closes the pool, and if ArC silently 
ignores it the managed pool leaks on redeploy/shutdown. The H2/Cockroach ITs 
test the produce path but not the dispose path, so not tested. 



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