Load zstd
This commit is contained in:
parent
b8b4b3c320
commit
34ff4bf9a2
@ -55,6 +55,18 @@ public class RocksDBLoader {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
RocksDB.loadLibrary();
|
RocksDB.loadLibrary();
|
||||||
}
|
}
|
||||||
|
for (final CompressionType compressionType : CompressionType.values()) {
|
||||||
|
try {
|
||||||
|
if (compressionType.getLibraryName() != null) {
|
||||||
|
System.loadLibrary(compressionType.getLibraryName());
|
||||||
|
}
|
||||||
|
} catch (final UnsatisfiedLinkError e) {
|
||||||
|
if (compressionType == CompressionType.ZSTD_COMPRESSION) {
|
||||||
|
throw new IllegalStateException("Can't load ZSTD", e);
|
||||||
|
}
|
||||||
|
// since it may be optional, we ignore its loading failure here.
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Path loadLibraryFromJarToTemp(final Path tmpDir) throws IOException {
|
private static Path loadLibraryFromJarToTemp(final Path tmpDir) throws IOException {
|
||||||
|
@ -56,9 +56,9 @@ public record SSTWriter(RocksDB db, it.cavallium.rockserver.core.impl.ColumnInst
|
|||||||
.setMaxOpenFiles(-1)
|
.setMaxOpenFiles(-1)
|
||||||
.setCompressionPerLevel(columnConifg.compressionPerLevel())
|
.setCompressionPerLevel(columnConifg.compressionPerLevel())
|
||||||
.setCompressionType(columnConifg.compressionType())
|
.setCompressionType(columnConifg.compressionType())
|
||||||
.setCompressionOptions(columnConifg.compressionOptions())
|
.setCompressionOptions(cloneCompressionOptions(columnConifg.compressionOptions()))
|
||||||
.setBottommostCompressionType(columnConifg.bottommostCompressionType())
|
.setBottommostCompressionType(columnConifg.bottommostCompressionType())
|
||||||
.setBottommostCompressionOptions(columnConifg.bottommostCompressionOptions());
|
.setBottommostCompressionOptions(cloneCompressionOptions(columnConifg.bottommostCompressionOptions()));
|
||||||
if (columnConifg.memTableConfig() != null) {
|
if (columnConifg.memTableConfig() != null) {
|
||||||
options.setMemTableConfig(columnConifg.memTableConfig());
|
options.setMemTableConfig(columnConifg.memTableConfig());
|
||||||
} else {
|
} else {
|
||||||
@ -83,6 +83,16 @@ public record SSTWriter(RocksDB db, it.cavallium.rockserver.core.impl.ColumnInst
|
|||||||
return sstWriter;
|
return sstWriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static CompressionOptions cloneCompressionOptions(CompressionOptions compressionOptions) {
|
||||||
|
return new CompressionOptions()
|
||||||
|
.setEnabled(compressionOptions.enabled())
|
||||||
|
.setMaxDictBytes(compressionOptions.maxDictBytes())
|
||||||
|
.setLevel(compressionOptions.level())
|
||||||
|
.setStrategy(compressionOptions.strategy())
|
||||||
|
.setZStdMaxTrainBytes(compressionOptions.zstdMaxTrainBytes())
|
||||||
|
.setWindowBits(compressionOptions.windowBits());
|
||||||
|
}
|
||||||
|
|
||||||
public void put(byte[] key, byte[] value) throws RocksDBException {
|
public void put(byte[] key, byte[] value) throws RocksDBException {
|
||||||
try {
|
try {
|
||||||
sstFileWriter.put(key, value);
|
sstFileWriter.put(key, value);
|
||||||
|
Loading…
Reference in New Issue
Block a user