Skip to content
Merged
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
6 changes: 6 additions & 0 deletions ydb/core/kqp/proxy_service/kqp_proxy_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,11 @@ class TKqpProxyService : public TActorBootstrapped<TKqpProxyService> {
}

if (sessionInfo) {
if (sessionInfo->Closing) {
TString error = TStringBuilder() << "Session is closing";
ReplyProcessError(Ydb::StatusIds::BAD_SESSION, error, requestId);
return;
}
LocalSessions->AttachQueryText(sessionInfo, ev->Get()->GetQuery());
}

Expand Down Expand Up @@ -784,6 +789,7 @@ class TKqpProxyService : public TActorBootstrapped<TKqpProxyService> {
}

if (sessionInfo) {
LocalSessions->SetSessionClosing(sessionInfo);
Send(sessionInfo->WorkerId, ev->Release().Release());
} else {
if (!sessionId.empty()) {
Expand Down
7 changes: 6 additions & 1 deletion ydb/core/kqp/proxy_service/kqp_proxy_service_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ struct TKqpSessionInfo {
TActorId AttachedRpcId;
bool PgWire;
TString QueryText;
bool Ready = true;
TString ClientApplicationName;
TString ClientSID;
TString ClientHost;
Expand All @@ -111,6 +110,7 @@ struct TKqpSessionInfo {
TInstant QueryStartAt;

ESessionState State = ESessionState::IDLE;
bool Closing = false;

struct TFieldsMap {
ui64 bitmap = 0;
Expand Down Expand Up @@ -246,6 +246,11 @@ class TLocalSessionsRegistry {
return candidate;
}

void SetSessionClosing(const TKqpSessionInfo* sessionInfo) {
TKqpSessionInfo* info = const_cast<TKqpSessionInfo*>(sessionInfo);
info->Closing = true;
}

void StartIdleCheck(const TKqpSessionInfo* sessionInfo, const TDuration idleDuration) {
if (!sessionInfo) {
return;
Expand Down
Loading