Skip to content

Commit

Permalink
introduce snapshot_ro isolation level (ydb-platform#11085) (ydb-platf…
Browse files Browse the repository at this point in the history
  • Loading branch information
ssmike authored and zinal committed Nov 7, 2024
1 parent 820106f commit f94d4a8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion ydb/core/kqp/common/kqp_tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ bool NeedSnapshot(const TKqpTransactionContext& txCtx, const NYql::TKikimrConfig
{
Y_UNUSED(config);

if (*txCtx.EffectiveIsolationLevel != NKikimrKqp::ISOLATION_LEVEL_SERIALIZABLE)
if (*txCtx.EffectiveIsolationLevel != NKikimrKqp::ISOLATION_LEVEL_SERIALIZABLE &&
*txCtx.EffectiveIsolationLevel != NKikimrKqp::ISOLATION_LEVEL_SNAPSHOT_RO)
return false;

if (txCtx.GetSnapshot().IsValid())
Expand Down
3 changes: 1 addition & 2 deletions ydb/core/kqp/common/kqp_tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ class TKqpTransactionContext : public NYql::TKikimrTransactionContextBase {
break;

case Ydb::Table::TransactionSettings::kSnapshotReadOnly:
// TODO: (KIKIMR-3374) Use separate isolation mode to avoid optimistic locks.
EffectiveIsolationLevel = NKikimrKqp::ISOLATION_LEVEL_SERIALIZABLE;
EffectiveIsolationLevel = NKikimrKqp::ISOLATION_LEVEL_SNAPSHOT_RO;
Readonly = true;
break;

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/kqp/executer_actor/kqp_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ std::unique_ptr<TEvKqpNode::TEvStartKqpTasksRequest> TKqpPlanner::SerializeReque
request.SetTxId(TxId);
if (LockTxId) {
request.SetLockTxId(*LockTxId);
request.SetLockNodeId(LockNodeId);
}
request.SetLockNodeId(LockNodeId);
ActorIdToProto(ExecuterId, request.MutableExecuterActorId());

if (Deadline) {
Expand Down
1 change: 1 addition & 0 deletions ydb/core/protos/kqp.proto
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ enum EIsolationLevel {
ISOLATION_LEVEL_READ_COMMITTED = 2;
ISOLATION_LEVEL_READ_UNCOMMITTED = 3;
ISOLATION_LEVEL_READ_STALE = 4;
ISOLATION_LEVEL_SNAPSHOT_RO = 5;
};

enum EQueryReplyFlags {
Expand Down

0 comments on commit f94d4a8

Please sign in to comment.