Skip to content

Commit

Permalink
[hotfix] Disable WAL in RocksDB state "clear"
Browse files Browse the repository at this point in the history
  • Loading branch information
aljoscha committed Apr 26, 2016
1 parent 06bf4bf commit 879bb1b
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.rocksdb.ColumnFamilyHandle;
import org.rocksdb.RocksDBException;

import org.rocksdb.WriteOptions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -62,6 +63,11 @@ public abstract class AbstractRocksDBState<K, N, S extends State, SD extends Sta
/** The column family of this particular instance of state */
protected ColumnFamilyHandle columnFamily;

/**
* We disable writes to the write-ahead-log here.
*/
private final WriteOptions writeOptions;

/**
* Creates a new RocksDB backed state.
*
Expand All @@ -75,6 +81,9 @@ protected AbstractRocksDBState(ColumnFamilyHandle columnFamily,
this.backend = backend;

this.columnFamily = columnFamily;

writeOptions = new WriteOptions();
writeOptions.setDisableWAL(true);
}

// ------------------------------------------------------------------------
Expand All @@ -86,7 +95,7 @@ public void clear() {
try {
writeKeyAndNamespace(out);
byte[] key = baos.toByteArray();
backend.db.remove(columnFamily, key);
backend.db.remove(columnFamily, writeOptions, key);
} catch (IOException|RocksDBException e) {
throw new RuntimeException("Error while removing entry from RocksDB", e);
}
Expand Down

0 comments on commit 879bb1b

Please sign in to comment.