Fix write batches
This commit is contained in:
parent
974d8b774a
commit
b9faeb020e
@ -431,8 +431,8 @@ public class EmbeddedDB implements RocksDBSyncAPI, Closeable {
|
|||||||
var key = keyIt.next();
|
var key = keyIt.next();
|
||||||
var value = valusIt.next();
|
var value = valusIt.next();
|
||||||
put(arena, wb, col, 0, key, value, requestType);
|
put(arena, wb, col, 0, key, value, requestType);
|
||||||
wb.write(db.get());
|
|
||||||
}
|
}
|
||||||
|
wb.write(db.get());
|
||||||
}
|
}
|
||||||
return List.of();
|
return List.of();
|
||||||
} catch (it.cavallium.rockserver.core.common.RocksDBException ex) {
|
} catch (it.cavallium.rockserver.core.common.RocksDBException ex) {
|
||||||
|
@ -7,9 +7,9 @@ import org.rocksdb.WriteBatch;
|
|||||||
import org.rocksdb.WriteOptions;
|
import org.rocksdb.WriteOptions;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public record WB(@NotNull WriteBatch wb) implements Closeable, TxOrWb {
|
public record WB(@NotNull WriteBatch wb) implements Closeable, TxOrWb {
|
||||||
|
private static final boolean MIGRATE = Boolean.parseBoolean(System.getProperty("rocksdb.migrate", "false"));
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
wb.close();
|
wb.close();
|
||||||
@ -17,6 +17,9 @@ public record WB(@NotNull WriteBatch wb) implements Closeable, TxOrWb {
|
|||||||
|
|
||||||
public void write(RocksDB rocksDB) throws RocksDBException {
|
public void write(RocksDB rocksDB) throws RocksDBException {
|
||||||
try (var w = new WriteOptions()) {
|
try (var w = new WriteOptions()) {
|
||||||
|
if (MIGRATE) {
|
||||||
|
w.setDisableWAL(true);
|
||||||
|
}
|
||||||
rocksDB.write(w, wb);
|
rocksDB.write(w, wb);
|
||||||
} catch (org.rocksdb.RocksDBException e) {
|
} catch (org.rocksdb.RocksDBException e) {
|
||||||
throw RocksDBException.of(RocksDBException.RocksDBErrorType.WRITE_BATCH_1, e);
|
throw RocksDBException.of(RocksDBException.RocksDBErrorType.WRITE_BATCH_1, e);
|
||||||
|
Loading…
Reference in New Issue
Block a user