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