Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public enum TxMode {

SERIALIZABLE_RW,
SNAPSHOT_RO,
SNAPSHOT_RW,
STALE_RO,

ONLINE_RO,
Expand Down
6 changes: 6 additions & 0 deletions query/src/main/java/tech/ydb/query/impl/TxControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class TxControl {
.setSnapshotReadOnly(YdbQuery.SnapshotModeSettings.getDefaultInstance())
.build();

private static final YdbQuery.TransactionSettings TS_SNAPSHOT_RW = YdbQuery.TransactionSettings.newBuilder()
.setSnapshotReadWrite(YdbQuery.SnapshotRWModeSettings.getDefaultInstance())
.build();

private static final YdbQuery.TransactionSettings TS_STALE = YdbQuery.TransactionSettings.newBuilder()
.setStaleReadOnly(YdbQuery.StaleModeSettings.getDefaultInstance())
.build();
Expand Down Expand Up @@ -55,6 +59,8 @@ public static YdbQuery.TransactionSettings txSettings(TxMode tx) {
return TS_SERIALIZABLE;
case SNAPSHOT_RO:
return TS_SNAPSHOT;
case SNAPSHOT_RW:
return TS_SNAPSHOT_RW;
case STALE_RO:
return TS_STALE;
case ONLINE_RO:
Expand Down
4 changes: 3 additions & 1 deletion table/src/main/java/tech/ydb/table/impl/TxControlToPb.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ public static YdbTable.TransactionSettings txSettings(TxMode tx) {
return TS_ONLINE;
case ONLINE_INCONSISTENT_RO:
return TS_ONLINE_INCONSISTENT;

case NONE:
case SNAPSHOT_RW:
default:
return null;
throw new IllegalArgumentException("Tx mode " + tx + " is not supported in TableService");
}
}
}