aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordcherednik <dcherednik@ydb.tech>2023-07-12 17:21:05 +0300
committerdcherednik <dcherednik@ydb.tech>2023-07-12 17:21:05 +0300
commit767f68dedab293899f7d4e810bba70904f886e05 (patch)
tree6acefcbbc06bcfa6c09b547fd6fc693bbcc17942
parent3aef944f32ba65f0bb01cb9e2590f885b5c4ca31 (diff)
downloadydb-767f68dedab293899f7d4e810bba70904f886e05.tar.gz
Do not run second wait cycle in case of CancelAfter timeout. KIKIMR-18698
Only session actor / executor can reply in case of query execution termination by cancel after timeout
-rw-r--r--ydb/core/kqp/proxy_service/kqp_proxy_service.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/ydb/core/kqp/proxy_service/kqp_proxy_service.cpp b/ydb/core/kqp/proxy_service/kqp_proxy_service.cpp
index 499782a2fe..50160cfbfd 100644
--- a/ydb/core/kqp/proxy_service/kqp_proxy_service.cpp
+++ b/ydb/core/kqp/proxy_service/kqp_proxy_service.cpp
@@ -1143,13 +1143,21 @@ public:
const TKqpSessionInfo* info = LocalSessions->FindPtr(reqInfo->SessionId);
if (msg->Round == 0 && info) {
- TString message = TStringBuilder() << "request's " << (msg->Status == NYql::NDqProto::StatusIds::TIMEOUT ? "timeout" : "cancelAfter") << " exceeded";
+ TString message = TStringBuilder()
+ << "request's " << (msg->Status == NYql::NDqProto::StatusIds::TIMEOUT ? "timeout" : "cancelAfter")
+ << " exceeded";
+
Send(info->WorkerId, new TEvKqp::TEvAbortExecution(msg->Status, message));
- auto newEv = ev->Release().Release();
- newEv->TickNextRound();
- Schedule(newEv->Timeout, newEv);
+
+ // We must not reply before session actor in case of CANCEL AFTER settings
+ if (msg->Status != NYql::NDqProto::StatusIds::CANCELLED) {
+ auto newEv = ev->Release().Release();
+ newEv->TickNextRound();
+ Schedule(newEv->Timeout, newEv);
+ }
} else {
- TString message = TStringBuilder() << "Query did not complete within specified timeout, session id " << reqInfo->SessionId;
+ TString message = TStringBuilder()
+ << "Query did not complete within specified timeout, session id " << reqInfo->SessionId;
ReplyProcessError(NYql::NDq::DqStatusToYdbStatus(msg->Status), message, requestId);
}
}