Myasuka commented on a change in pull request #17833:
URL: https://github.com/apache/flink/pull/17833#discussion_r774847337
##########
File path:
flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBStateBackendConfigTest.java
##########
@@ -97,6 +97,19 @@ public void testDefaultsInSync() throws Exception {
assertEquals(defaultIncremental,
backend.isIncrementalCheckpointsEnabled());
}
+ @Test
+ public void testDefaultDbLogDir() throws Exception {
+ final EmbeddedRocksDBStateBackend backend = new
EmbeddedRocksDBStateBackend();
+ final File logFile = File.createTempFile(getClass().getSimpleName() +
"-", ".log");
+ // set the environment variable 'log.file' with the Flink log file
location
+ System.setProperty("log.file", logFile.getPath());
+ final RocksDBResourceContainer container =
backend.createOptionsAndResourceContainer();
Review comment:
Why not use try-with-resource to ensure the resource container would be
closed finally? Otherwise if `assertEquals` throwing any exception, it would
cause the native resource leak. You can search the usage of
`createOptionsAndResourceContainer` in test code to see how we hanlde this
before.
--
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]