forked from hugegraph/hugegraph-sync
feat: support disable RocksDB auto-compaction by configuration (#2586)
This commit is contained in:
parent
899dc8e0f0
commit
5dfcc3f694
|
|
@ -120,6 +120,13 @@ public class RocksDBOptions extends OptionHolder {
|
|||
disallowEmpty(),
|
||||
"rocksdb-snapshot"
|
||||
);
|
||||
public static final ConfigOption<Boolean> DISABLE_AUTO_COMPACTION =
|
||||
new ConfigOption<>(
|
||||
"rocksdb.disable_auto_compaction",
|
||||
"Set disable auto compaction.",
|
||||
disallowEmpty(),
|
||||
false
|
||||
);
|
||||
public static final ConfigConvOption<String, CompactionStyle> COMPACTION_STYLE =
|
||||
new ConfigConvOption<>(
|
||||
"rocksdb.compaction_style",
|
||||
|
|
|
|||
|
|
@ -430,6 +430,9 @@ public class RocksDBSession implements AutoCloseable, Cloneable {
|
|||
List<byte[]> 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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue