Skip to content

Commit

Permalink
fix name
Browse files Browse the repository at this point in the history
  • Loading branch information
VPolka committed May 27, 2024
1 parent 6a93b06 commit c34380a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
11 changes: 4 additions & 7 deletions ydb/core/kqp/session_actor/kqp_query_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,23 @@ using namespace NSchemeCache;


TKqpQueryState::TQueryTxId::TQueryTxId(const TQueryTxId& other) {
YQL_ENSURE(!IsValueSet);
YQL_ENSURE(!Id);
Id = other.Id;
IsValueSet = true;
}

TKqpQueryState::TQueryTxId& TKqpQueryState::TQueryTxId::operator=(const TQueryTxId& id) {
YQL_ENSURE(!IsValueSet);
YQL_ENSURE(!Id);
Id = id.Id;
IsValueSet = true;
return *this;
}

void TKqpQueryState::TQueryTxId::SetValue(const TTxId& id) {
YQL_ENSURE(!IsValueSet);
YQL_ENSURE(!Id);
Id = id.Id;
IsValueSet = true;
}

TTxId TKqpQueryState::TQueryTxId::GetValue() {
return Id;
return Id ? *Id : TTxId();
}

void TKqpQueryState::TQueryTxId::Reset() {
Expand Down
5 changes: 2 additions & 3 deletions ydb/core/kqp/session_actor/kqp_query_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class TKqpQueryState : public TNonCopyable {
void Reset();

private:
TTxId Id;
bool IsValueSet = false;
TMaybe<TTxId> Id;
};

TKqpQueryState(TEvKqp::TEvQueryRequest::TPtr& ev, ui64 queryId, const TString& database, const TMaybe<TString>& applicationName,
Expand Down Expand Up @@ -148,7 +147,7 @@ class TKqpQueryState : public TNonCopyable {
NYql::TIssues Issues;

TVector<TQueryAst> Statements;
TMaybe<TQueryTxId> ImpliedTxId = {}; // Implied tx
TMaybe<TQueryTxId> ImplicitTxId = {}; // Implicit tx for all statements
ui32 CurrentStatementId = 0;
ui32 StatementResultIndex = 0;
ui32 StatementResultSize = 0;
Expand Down
9 changes: 5 additions & 4 deletions ydb/core/kqp/session_actor/kqp_session_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ class TKqpSessionActor : public TActorBootstrapped<TKqpSessionActor> {
Ydb::Table::TransactionSettings settings;
settings.mutable_serializable_read_write();
BeginTx(settings);
QueryState->ImpliedTxId = QueryState->TxId;
QueryState->ImplicitTxId = QueryState->TxId;
CompileStatement();
}

Expand Down Expand Up @@ -724,8 +724,8 @@ class TKqpSessionActor : public TActorBootstrapped<TKqpSessionActor> {
Ydb::Table::TransactionControl GetImpliedTxControl() {
Ydb::Table::TransactionControl control;
control.set_commit_tx(QueryState->ProcessingLastStatement());
if (QueryState->ImpliedTxId) {
control.set_tx_id(QueryState->ImpliedTxId->GetValue().GetHumanStr());
if (QueryState->ImplicitTxId) {
control.set_tx_id(QueryState->ImplicitTxId->GetValue().GetHumanStr());
} else {
control.mutable_begin_tx()->mutable_serializable_read_write();
}
Expand All @@ -748,7 +748,8 @@ class TKqpSessionActor : public TActorBootstrapped<TKqpSessionActor> {
}
QueryState->TxCtx = txCtx;
QueryState->QueryData = std::make_shared<TQueryData>(QueryState->TxCtx->TxAlloc);
if (QueryState->TxId.GetValue() != txId) {
if (hasTxControl) {
LOG_E("AAA");
QueryState->TxId.SetValue(txId);
}
break;
Expand Down

0 comments on commit c34380a

Please sign in to comment.