Load zstd before rocksdb
This commit is contained in:
parent
1621bb73ca
commit
b2bfd0f23a
@ -43,18 +43,6 @@ public class RocksDBLoader {
|
|||||||
private static final String bugFallbackJniLibraryFileName = Environment.getFallbackJniLibraryFileName("rocksdbjni");
|
private static final String bugFallbackJniLibraryFileName = Environment.getFallbackJniLibraryFileName("rocksdbjni");
|
||||||
|
|
||||||
public static void loadLibrary() {
|
public static void loadLibrary() {
|
||||||
try {
|
|
||||||
String currentUsersHomeDir = System.getProperty("user.home");
|
|
||||||
var jniPath = Path.of(currentUsersHomeDir).resolve(".jni").resolve("rocksdb").resolve(RocksDBMetadata.getRocksDBVersionHash());
|
|
||||||
if (Files.notExists(jniPath)) {
|
|
||||||
Files.createDirectories(jniPath);
|
|
||||||
}
|
|
||||||
loadLibraryFromJarToTemp(jniPath);
|
|
||||||
|
|
||||||
RocksDB.loadLibrary(List.of(jniPath.toAbsolutePath().toString()));
|
|
||||||
} catch (IOException e) {
|
|
||||||
RocksDB.loadLibrary();
|
|
||||||
}
|
|
||||||
for (final CompressionType compressionType : CompressionType.values()) {
|
for (final CompressionType compressionType : CompressionType.values()) {
|
||||||
try {
|
try {
|
||||||
if (compressionType.getLibraryName() != null) {
|
if (compressionType.getLibraryName() != null) {
|
||||||
@ -67,6 +55,18 @@ public class RocksDBLoader {
|
|||||||
// since it may be optional, we ignore its loading failure here.
|
// since it may be optional, we ignore its loading failure here.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
String currentUsersHomeDir = System.getProperty("user.home");
|
||||||
|
var jniPath = Path.of(currentUsersHomeDir).resolve(".jni").resolve("rocksdb").resolve(RocksDBMetadata.getRocksDBVersionHash());
|
||||||
|
if (Files.notExists(jniPath)) {
|
||||||
|
Files.createDirectories(jniPath);
|
||||||
|
}
|
||||||
|
loadLibraryFromJarToTemp(jniPath);
|
||||||
|
|
||||||
|
RocksDB.loadLibrary(List.of(jniPath.toAbsolutePath().toString()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
RocksDB.loadLibrary();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Path loadLibraryFromJarToTemp(final Path tmpDir) throws IOException {
|
private static Path loadLibraryFromJarToTemp(final Path tmpDir) throws IOException {
|
||||||
|
Loading…
Reference in New Issue
Block a user