From 8c2f3b89b63794563363c9818e70f2ca52a716c0 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Thu, 9 Jun 2022 00:13:44 +0200 Subject: [PATCH] Use LZ4 compression as fallback --- .../disk/LLLocalKeyValueDatabase.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalKeyValueDatabase.java b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalKeyValueDatabase.java index 2f6ac2f..0c2a0f2 100644 --- a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalKeyValueDatabase.java +++ b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalKeyValueDatabase.java @@ -217,18 +217,23 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase { if (isDisableAutoCompactions()) { columnFamilyOptions.setDisableAutoCompactions(true); } - columnFamilyOptions.setEnableBlobFiles(columnOptions.blobFiles()); - if (columnOptions.blobFileSize().isPresent()) { - columnFamilyOptions.setBlobFileSize(columnOptions.blobFileSize().get()); + var blobFiles = columnOptions.blobFiles(); + columnFamilyOptions.setEnableBlobFiles(blobFiles); + if (blobFiles) { + if (columnOptions.blobFileSize().isPresent()) { + columnFamilyOptions.setBlobFileSize(columnOptions.blobFileSize().get()); + } + if (columnOptions.minBlobSize().isPresent()) { + columnFamilyOptions.setMinBlobSize(columnOptions.minBlobSize().get()); + } + if (columnOptions.blobCompressionType().isPresent()) { + columnFamilyOptions.setCompressionType(columnOptions.blobCompressionType().get().getType()); + } else { + columnFamilyOptions.setCompressionType(CompressionType.LZ4_COMPRESSION); + } + columnFamilyOptions.setBlobCompactionReadaheadSize(4 * SizeUnit.MB); + columnFamilyOptions.setEnableBlobGarbageCollection(true); } - if (columnOptions.minBlobSize().isPresent()) { - columnFamilyOptions.setMinBlobSize(columnOptions.minBlobSize().get()); - } - if (columnOptions.blobCompressionType().isPresent()) { - columnFamilyOptions.setCompressionType(columnOptions.blobCompressionType().get().getType()); - } - columnFamilyOptions.setBlobCompactionReadaheadSize(4 * SizeUnit.MB); - columnFamilyOptions.setEnableBlobGarbageCollection(true); // This option is not supported with multiple db paths // https://www.arangodb.com/docs/stable/programs-arangod-rocksdb.html