diff --git a/src/main/java/it/cavallium/rockserver/core/impl/EmbeddedDB.java b/src/main/java/it/cavallium/rockserver/core/impl/EmbeddedDB.java index 348dd00..9c5957e 100644 --- a/src/main/java/it/cavallium/rockserver/core/impl/EmbeddedDB.java +++ b/src/main/java/it/cavallium/rockserver/core/impl/EmbeddedDB.java @@ -431,8 +431,8 @@ public class EmbeddedDB implements RocksDBSyncAPI, Closeable { var key = keyIt.next(); var value = valusIt.next(); put(arena, wb, col, 0, key, value, requestType); - wb.write(db.get()); } + wb.write(db.get()); } return List.of(); } catch (it.cavallium.rockserver.core.common.RocksDBException ex) { diff --git a/src/main/java/it/cavallium/rockserver/core/impl/rocksdb/WB.java b/src/main/java/it/cavallium/rockserver/core/impl/rocksdb/WB.java index 3a6cbfc..c017889 100644 --- a/src/main/java/it/cavallium/rockserver/core/impl/rocksdb/WB.java +++ b/src/main/java/it/cavallium/rockserver/core/impl/rocksdb/WB.java @@ -7,9 +7,9 @@ import org.rocksdb.WriteBatch; import org.rocksdb.WriteOptions; import java.io.Closeable; -import java.io.IOException; public record WB(@NotNull WriteBatch wb) implements Closeable, TxOrWb { + private static final boolean MIGRATE = Boolean.parseBoolean(System.getProperty("rocksdb.migrate", "false")); @Override public void close() { wb.close(); @@ -17,6 +17,9 @@ public record WB(@NotNull WriteBatch wb) implements Closeable, TxOrWb { public void write(RocksDB rocksDB) throws RocksDBException { try (var w = new WriteOptions()) { + if (MIGRATE) { + w.setDisableWAL(true); + } rocksDB.write(w, wb); } catch (org.rocksdb.RocksDBException e) { throw RocksDBException.of(RocksDBException.RocksDBErrorType.WRITE_BATCH_1, e);