diff --git a/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/RocksDBOptions.java b/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/RocksDBOptions.java index 9d380b3356..6f5c35f627 100644 --- a/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/RocksDBOptions.java +++ b/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/RocksDBOptions.java @@ -120,6 +120,13 @@ public class RocksDBOptions extends OptionHolder { disallowEmpty(), "rocksdb-snapshot" ); + public static final ConfigOption DISABLE_AUTO_COMPACTION = + new ConfigOption<>( + "rocksdb.disable_auto_compaction", + "Set disable auto compaction.", + disallowEmpty(), + false + ); public static final ConfigConvOption COMPACTION_STYLE = new ConfigConvOption<>( "rocksdb.compaction_style", diff --git a/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/RocksDBSession.java b/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/RocksDBSession.java index 70299f8f09..d1f89262a3 100644 --- a/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/RocksDBSession.java +++ b/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/RocksDBSession.java @@ -430,6 +430,9 @@ private void openRocksDB(String dbDataPath, long version) { List columnFamilyBytes = RocksDB.listColumnFamilies(new Options(), dbPath); ColumnFamilyOptions cfOptions = new ColumnFamilyOptions(); + if (hugeConfig.get(RocksDBOptions.DISABLE_AUTO_COMPACTION)) { + cfOptions.setDisableAutoCompactions(true); + } RocksDBSession.initOptions(this.hugeConfig, null, null, cfOptions, cfOptions); if (columnFamilyBytes.size() > 0) {