StephanEwen commented on a change in pull request #10423: [FLINK-14378][state]
Cleanup rocksDB lib folder if fail to load library
URL: https://github.com/apache/flink/pull/10423#discussion_r355124379
##########
File path:
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateBackend.java
##########
@@ -875,7 +879,13 @@ private static void ensureRocksDBIsLoaded(String
tempDirectory) throws IOExcepti
// instances of the same JNI
library being loaded in different class loaders, but
// apparently not when coming
from the same file path, so there we go)
- final File rocksLibFolder = new
File(tempDirParent, "rocksdb-lib-" + new AbstractID());
+ rocksLibFolder = new
File(tempDirParent, "rocksdb-lib-" + new AbstractID());
+ // make sure the temp path
exists
+ LOG.debug("Attempting to create
RocksDB native library folder {}", rocksLibFolder);
+
+ // noinspection
ResultOfMethodCallIgnored
+ rocksLibFolder.mkdirs();
+ rocksLibFolder.deleteOnExit();
Review comment:
The directory should be deleted anyways on shutdown, because the
TaskManagers have a shutdown hook to clean up their temp directories.
I would suggest to drop `deleteOnExit()`, because as far as I know it can
also be problematic and lead to memory leaks.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services