Configurable optimistic transactions
This commit is contained in:
parent
aa04a64c34
commit
9309692062
@ -8,4 +8,5 @@ import org.jetbrains.annotations.Nullable;
|
||||
@RecordBuilder
|
||||
public record DatabaseOptions(List<DatabaseVolume> volumes, Map<String, String> extraFlags, boolean absoluteConsistency,
|
||||
boolean lowMemory, boolean inMemory, boolean useDirectIO, boolean allowMemoryMapping,
|
||||
boolean allowNettyDirect, int maxOpenFiles, @Nullable Long memtableMemoryBudgetBytes) {}
|
||||
boolean allowNettyDirect, boolean optimistic, int maxOpenFiles,
|
||||
@Nullable Long memtableMemoryBudgetBytes) {}
|
||||
|
@ -155,7 +155,11 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
|
||||
while (true) {
|
||||
try {
|
||||
// a factory method that returns a RocksDB instance
|
||||
if (databaseOptions.optimistic()) {
|
||||
this.db = OptimisticTransactionDB.open(new DBOptions(rocksdbOptions), dbPathString, descriptors, handles);
|
||||
} else {
|
||||
this.db = TransactionDB.open(new DBOptions(rocksdbOptions), dbPathString, descriptors, handles);
|
||||
}
|
||||
break;
|
||||
} catch (RocksDBException ex) {
|
||||
switch (ex.getMessage()) {
|
||||
|
@ -78,7 +78,7 @@ public class LocalTemporaryDbGenerator implements TemporaryDbGenerator {
|
||||
conn.getDatabase("testdb",
|
||||
List.of(Column.dictionary("testmap"), Column.special("ints"), Column.special("longs")),
|
||||
new DatabaseOptions(List.of(), Map.of(), true, false, true, false,
|
||||
true, canUseNettyDirect, -1, null)
|
||||
true, canUseNettyDirect, true, -1, null)
|
||||
),
|
||||
conn.getLuceneIndex("testluceneindex1",
|
||||
1,
|
||||
|
@ -49,7 +49,7 @@ public class MemoryTemporaryDbGenerator implements TemporaryDbGenerator {
|
||||
.zip(
|
||||
conn.getDatabase("testdb",
|
||||
List.of(Column.dictionary("testmap"), Column.special("ints"), Column.special("longs")),
|
||||
new DatabaseOptions(List.of(), Map.of(), true, false, true, false, true, canUseNettyDirect, -1, null)
|
||||
new DatabaseOptions(List.of(), Map.of(), true, false, true, false, true, canUseNettyDirect, true, -1, null)
|
||||
),
|
||||
conn.getLuceneIndex("testluceneindex1",
|
||||
1,
|
||||
|
Loading…
Reference in New Issue
Block a user