Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nikvas0 committed Dec 29, 2023
1 parent 7924909 commit 24ae993
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ydb/core/kqp/session_actor/kqp_tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,18 +291,22 @@ class TKqpTransactionContext : public NYql::TKikimrTransactionContextBase {

struct TTxId {
TULID Id;
TString HumanStr;

TTxId()
: Id(TULID::Min())
{}

TTxId(const TULID& other)
: Id(other)
, HumanStr(Id.ToString())
{}

static TTxId FromString(const TString& str) {
TTxId res;
YQL_ENSURE(res.Id.ParseString(str));
if (res.Id.ParseString(str)) {
res.HumanStr = str;
}
return res;
}

Expand All @@ -311,7 +315,7 @@ struct TTxId {
}

TString GetHumanStr() {
return Id.ToString();
return HumanStr;
}
};

Expand All @@ -325,13 +329,16 @@ struct THash<NKikimr::NKqp::TTxId> {
};

namespace NKikimr::NKqp {

class TTransactionsCache {
size_t MaxActiveSize;
THashMap<TTxId, TIntrusivePtr<TKqpTransactionContext>, THash<NKikimr::NKqp::TTxId>> Active;
std::deque<TIntrusivePtr<TKqpTransactionContext>> ToBeAborted;

auto FindOldestTransaction() {
if (Active.empty()) {
return std::end(Active);
}
auto oldest = std::begin(Active);
for (auto it = std::next(oldest); it != std::end(Active); ++it) {
if (oldest->second->LastAccessTime < it->second->LastAccessTime) {
Expand Down Expand Up @@ -435,4 +442,4 @@ bool NeedSnapshot(const TKqpTransactionContext& txCtx, const NYql::TKikimrConfig

bool HasOlapTableInTx(const NKqpProto::TKqpPhyQuery& physicalQuery);

} // namespace NKikimr::NKqp
} // namespace NKikimr::NKqp

0 comments on commit 24ae993

Please sign in to comment.