Skip to content

Commit

Permalink
Disable rocksdb wal for statemachine on raft mode
Browse files Browse the repository at this point in the history
Change-Id: I59c9b174a57aaf3859067459dd3195960e6d8d3c
  • Loading branch information
Linary committed Dec 28, 2020
1 parent 0f15c46 commit 3f5f469
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import com.baidu.hugegraph.backend.store.BackendEntry.BackendColumn;
import com.baidu.hugegraph.backend.store.BackendEntry.BackendColumnIterator;
import com.baidu.hugegraph.backend.store.BackendEntryIterator;
import com.baidu.hugegraph.config.CoreOptions;
import com.baidu.hugegraph.config.HugeConfig;
import com.baidu.hugegraph.util.Bytes;
import com.baidu.hugegraph.util.E;
Expand Down Expand Up @@ -683,11 +684,17 @@ private final class StdSession extends RocksDBSessions.Session {
private WriteOptions writeOptions;

public StdSession(HugeConfig conf) {
boolean bulkload = conf.get(RocksDBOptions.BULKLOAD_MODE);
boolean raftMode = conf.get(CoreOptions.RAFT_MODE);
this.batch = new WriteBatch();
this.writeOptions = new WriteOptions();
this.writeOptions.setDisableWAL(bulkload);
//this.writeOptions.setSync(false);
/*
* When work under raft mode. if store crashed, the state-machine
* can restore by snapshot + raft log, doesn't need wal and sync
*/
if (raftMode) {
this.writeOptions.setDisableWAL(true);
this.writeOptions.setSync(false);
}
}

@Override
Expand Down

0 comments on commit 3f5f469

Please sign in to comment.