jerryshao commented on code in PR #14981:
URL: https://github.com/apache/gravitino/pull/14981#discussion_r4583531621
##########
integration-test-common/src/test/java/org/apache/gravitino/integration/test/MiniGravitino.java:
##########
@@ -277,6 +278,36 @@ Map<String, String> getIcebergRestServiceConfigs() throws
IOException {
return customConfigs;
}
+ // Customize the config file
+ @VisibleForTesting
+ void customizeConfigFile(String configTempFileName, String configFileName)
throws IOException {
+ Map<String, String> configMap = new HashMap<>();
+ configMap.put(
+ GravitinoServer.WEBSERVER_CONF_PREFIX +
JettyServerConfig.WEBSERVER_HTTP_PORT.getKey(),
+ String.valueOf(RESTUtils.findAvailablePort(2000, 3000)));
+
+ configMap.putAll(getIcebergRestServiceConfigs());
+ configMap.putAll(getLanceRestServiceConfigs(configMap));
+ configMap.putAll(context.customConfig);
+
+ Properties configProperties = serverConfig.loadPropertiesFromFile(new
File(configTempFileName));
+ configProperties.putAll(configMap);
+ // Match server startup: load JVM properties first, then apply the
generated file's overrides.
+ ServerConfig config = new ServerConfig();
+ config.loadFromProperties(configProperties);
+ String jdbcUrl = config.get(Configs.ENTITY_RELATIONAL_JDBC_BACKEND_URL);
+ if (Configs.DEFAULT_RELATIONAL_JDBC_BACKEND_URL.equals(jdbcUrl)) {
+ // H2 2.2.224 can panic when its asynchronous chunk writer checks
free-space state while
+ // another thread removes unused chunks (h2database/h2database#4048).
Synchronous writes
+ // avoid that pipeline in the default embedded test database. Preserve
explicit JDBC URLs
+ // so tests can still select other backends or exercise different H2
settings.
+ configProperties.setProperty(
+ Configs.ENTITY_RELATIONAL_JDBC_BACKEND_URL_KEY,
+ H2Database.getConnectionUrl(config) + ";WRITE_DELAY=0");
+ }
+ ITUtils.overwriteConfigFile(configFileName, configProperties);
Review Comment:
[P2] With a JVM storage path such as `/tmp/café/metadata`, the generated
file changes which database H2 opens. `overwriteConfigFile` writes the derived
URL as UTF-8, but startup reads it with `Properties.load(InputStream)`, so the
reloaded path contains `café`. Please make the URL round-trip through the
properties writer and reader, including the later rewrites when auxiliary
services are disabled. A regression test can give `testUsesStoragePathFromJvm`
a non-ASCII path component and verify the reloaded URL still points there.
--
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]