diff options
author | Vasily Gerasimov <UgnineSirdis@gmail.com> | 2022-06-16 17:08:49 +0300 |
---|---|---|
committer | Vasily Gerasimov <UgnineSirdis@gmail.com> | 2022-06-16 17:08:49 +0300 |
commit | 108a3f2a5b7ace8b0d68d936451961c889a94aa3 (patch) | |
tree | d1aaea4776e5422ca6cf4c5881ef9133025e9782 | |
parent | 572ded33554f05c3eef8e344145ed401b2c2e4c7 (diff) | |
download | ydb-108a3f2a5b7ace8b0d68d936451961c889a94aa3.tar.gz |
YQ-1095 Fix MaybeBindAllocator. Add logging to all internal error cases
Log all internal errors
BindAllocator recursively
ref:03a027c029f5d8bf568b251acb33a0a28f7b46bb
-rw-r--r-- | ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h b/ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h index f9c5c415e4..afdd8cfd93 100644 --- a/ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h +++ b/ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h @@ -519,35 +519,42 @@ protected: } void InternalError(TIssuesIds::EIssueCode issueCode, const TString& message) { - CA_LOG_E(TIssuesIds::EIssueCode_Name(issueCode) << ": " << message << "."); - TIssue issue(message); - SetIssueCode(issueCode, issue); - std::optional<TGuard<NKikimr::NMiniKQL::TScopedAlloc>> guard = MaybeBindAllocator(); - State = NDqProto::COMPUTE_STATE_FAILURE; - ReportStateAndMaybeDie(NYql::NDqProto::StatusIds::PRECONDITION_FAILED, {std::move(issue)}); + InternalError(NYql::NDqProto::StatusIds::PRECONDITION_FAILED, issueCode, message); } void InternalError(NYql::NDqProto::StatusIds::StatusCode statusCode, TIssuesIds::EIssueCode issueCode, const TString& message) { - CA_LOG_E("InternalError: " << NYql::NDqProto::StatusIds_StatusCode_Name(statusCode) << " " << TIssuesIds::EIssueCode_Name(issueCode) << ": " << message << "."); TIssue issue(message); SetIssueCode(issueCode, issue); - std::optional<TGuard<NKikimr::NMiniKQL::TScopedAlloc>> guard = MaybeBindAllocator(); - State = NDqProto::COMPUTE_STATE_FAILURE; - ReportStateAndMaybeDie(statusCode, TIssues({std::move(issue)})); + InternalError(statusCode, std::move(issue)); } void InternalError(NYql::NDqProto::StatusIds::StatusCode statusCode, TIssue issue) { - std::optional<TGuard<NKikimr::NMiniKQL::TScopedAlloc>> guard = MaybeBindAllocator(); - State = NDqProto::COMPUTE_STATE_FAILURE; - ReportStateAndMaybeDie(statusCode, TIssues({std::move(issue)})); + InternalError(statusCode, TIssues({std::move(issue)})); } void InternalError(NYql::NDqProto::StatusIds::StatusCode statusCode, TIssues issues) { + CA_LOG_E(InternalErrorLogString(statusCode, issues)); + std::optional<TGuard<NKikimr::NMiniKQL::TScopedAlloc>> guard = MaybeBindAllocator(); State = NDqProto::COMPUTE_STATE_FAILURE; ReportStateAndMaybeDie(statusCode, issues); } + TString InternalErrorLogString(NYql::NDqProto::StatusIds::StatusCode statusCode, const TIssues& issues) { + TStringBuilder log; + log << "InternalError: " << NYql::NDqProto::StatusIds_StatusCode_Name(statusCode); + if (issues) { + const auto& issueCodeName = TIssuesIds::EIssueCode_Name(issues.begin()->GetCode()); + if (!issueCodeName.empty()) { + log << ' ' << issueCodeName; + } + log << ": "; + issues.PrintTo(log.Out, true /* oneLine */); + } + log << '.'; + return std::move(log); + } + void ContinueExecute() { if (!ResumeEventScheduled && Running) { ResumeEventScheduled = true; @@ -860,11 +867,7 @@ protected: } virtual std::optional<TGuard<NKikimr::NMiniKQL::TScopedAlloc>> MaybeBindAllocator() { - std::optional<TGuard<NKikimr::NMiniKQL::TScopedAlloc>> guard; - if (!TaskRunner->GetTypeEnv().GetAllocator().IsAttached()) { - guard.emplace(TaskRunner->BindAllocator()); - } - return guard; + return TaskRunner->BindAllocator(); } virtual void AsyncInputPush(NKikimr::NMiniKQL::TUnboxedValueVector&& batch, TAsyncInputInfoBase& source, i64 space, bool finished) { |