rdblue commented on code in PR #4495:
URL: https://github.com/apache/iceberg/pull/4495#discussion_r847507141
##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -42,20 +50,29 @@ public void createCatalog() {
File warehouse = temp.toFile();
Configuration conf = new Configuration();
- JdbcCatalog backendCatalog = new JdbcCatalog();
- backendCatalog.setConf(conf);
- Map<String, String> backendCatalogProperties = ImmutableMap.of(
- CatalogProperties.WAREHOUSE_LOCATION, warehouse.getAbsolutePath(),
- CatalogProperties.URI, "jdbc:sqlite:file::memory:?ic" +
UUID.randomUUID().toString().replace("-", ""),
- JdbcCatalog.PROPERTY_PREFIX + "username", "user",
- JdbcCatalog.PROPERTY_PREFIX + "password", "password");
- backendCatalog.initialize("backend", backendCatalogProperties);
+ this.restCatalog = new RESTCatalog((config) -> {
+ JdbcCatalog backendCatalog = new JdbcCatalog();
+ backendCatalog.setConf(conf);
+ Map<String, String> backendCatalogProperties = ImmutableMap.of(
+ CatalogProperties.WAREHOUSE_LOCATION, warehouse.getAbsolutePath(),
+ CatalogProperties.URI, "jdbc:sqlite:file::memory:?ic" +
UUID.randomUUID().toString().replace("-", ""),
+ JdbcCatalog.PROPERTY_PREFIX + "username", "user",
+ JdbcCatalog.PROPERTY_PREFIX + "password", "password");
Review Comment:
I'm a bit concerned about this because it creates an entirely new JDBC
catalog. It works for tests now, but if we were to send slightly different
config back when loading a table, the catalog would create a new connection and
wipe the DB.
Could this be solved instead by skipping `catalog.close()` in the
`RESTCatalogAdaptor.close` method? We could simply close the `backendCatalog`
in an `@AfterEach` method.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]