diff options
author | hor911 <hor911@ydb.tech> | 2023-02-22 19:14:06 +0300 |
---|---|---|
committer | hor911 <hor911@ydb.tech> | 2023-02-22 19:14:06 +0300 |
commit | 1e6f361ca50218237c7d536cbba32cdee2e9fb2e (patch) | |
tree | d64381e30e6fd8de7bed78bb83f454b2e3d2d993 | |
parent | 1cc651a983645fff1a09285fc5c1d03adab74b90 (diff) | |
download | ydb-1e6f361ca50218237c7d536cbba32cdee2e9fb2e.tar.gz |
Hide INTERNAL_ERROR issues from end user
6 files changed, 34 insertions, 3 deletions
diff --git a/ydb/core/yq/libs/actors/run_actor.cpp b/ydb/core/yq/libs/actors/run_actor.cpp index 66c074e6fd..0f8508b284 100644 --- a/ydb/core/yq/libs/actors/run_actor.cpp +++ b/ydb/core/yq/libs/actors/run_actor.cpp @@ -1016,13 +1016,27 @@ private: Issues.AddIssues(issues); } + TIssue WrapInternalIssues(const TIssues& issues) { + NYql::IssuesToMessage(issues, QueryStateUpdateRequest.mutable_internal_issues()); + TString referenceId = GetEntityIdAsString(Params.CommonConfig.GetIdsPrefix(), EEntityType::UNDEFINED); + LOG_E(referenceId << ": " << issues.ToOneLineString()); + return TIssue("Contact technical support and provide query information and this id: " + referenceId + "_" + Now().ToStringUpToSeconds()); + } + void SaveQueryResponse(NYql::NDqs::TEvQueryResponse::TPtr& ev) { auto& result = ev->Get()->Record; - LOG_D("Query response. Result set index: " << DqGraphIndex + LOG_D("Query response " << NYql::NDqProto::StatusIds_StatusCode_Name(ev->Get()->Record.GetStatusCode()) + << ". Result set index: " << DqGraphIndex << ". Issues count: " << result.IssuesSize() << ". Rows count: " << result.GetRowsCount()); - AddIssues(result.issues()); + if (ev->Get()->Record.GetStatusCode() == NYql::NDqProto::StatusIds::INTERNAL_ERROR && !Params.CommonConfig.GetKeepInternalErrors()) { + TIssues issues; + IssuesFromMessage(result.issues(), issues); + Issues.AddIssue(WrapInternalIssues(issues)); + } else { + AddIssues(result.issues()); + } if (Finishing && !result.issues_size()) { // Race between abort and successful finishing. Override with success and provide results to user. FinalQueryStatus = YandexQuery::QueryMeta::COMPLETED; @@ -1053,13 +1067,21 @@ private: auto& result = ev->Get()->Record; - LOG_D("Query evaluation " << it->second.Index << " response. Issues count: " << result.IssuesSize() + LOG_D("Query evaluation " << NYql::NDqProto::StatusIds_StatusCode_Name(result.GetStatusCode()) + << "." << it->second.Index << " response. Issues count: " << result.IssuesSize() << ". Rows count: " << result.GetRowsCount()); queryResult.Data = result.yson(); TIssues issues; IssuesFromMessage(result.GetIssues(), issues); + + if (result.GetStatusCode() == NYql::NDqProto::StatusIds::INTERNAL_ERROR && !Params.CommonConfig.GetKeepInternalErrors()) { + auto issue = WrapInternalIssues(issues); + issues.Clear(); + issues.AddIssue(issue); + } + bool error = false; for (const auto& issue : issues) { if (issue.GetSeverity() <= TSeverityIds::S_ERROR) { diff --git a/ydb/core/yq/libs/config/protos/common.proto b/ydb/core/yq/libs/config/protos/common.proto index a657cbed22..c2667393a0 100644 --- a/ydb/core/yq/libs/config/protos/common.proto +++ b/ydb/core/yq/libs/config/protos/common.proto @@ -25,4 +25,5 @@ message TCommonConfig { uint64 QueryArtifactsCompressionMinSize = 10; string MonitoringEndpoint = 11; uint64 MaxTasksPerStage = 12; + bool KeepInternalErrors = 13; } diff --git a/ydb/core/yq/libs/control_plane_storage/internal/task_ping.cpp b/ydb/core/yq/libs/control_plane_storage/internal/task_ping.cpp index 321897d3c7..07394f1277 100644 --- a/ydb/core/yq/libs/control_plane_storage/internal/task_ping.cpp +++ b/ydb/core/yq/libs/control_plane_storage/internal/task_ping.cpp @@ -183,6 +183,10 @@ TPingTaskParams ConstructHardPingTask( NYql::IssuesToMessage(newIssues, query.mutable_transient_issue()); } + if (request.internal_issues().size()) { + *internal.mutable_internal_issue() = request.internal_issues(); + } + if (request.statistics()) { TString statistics; try { diff --git a/ydb/core/yq/libs/control_plane_storage/proto/yq_internal.proto b/ydb/core/yq/libs/control_plane_storage/proto/yq_internal.proto index 1783710ad0..f056df4de9 100644 --- a/ydb/core/yq/libs/control_plane_storage/proto/yq_internal.proto +++ b/ydb/core/yq/libs/control_plane_storage/proto/yq_internal.proto @@ -7,6 +7,7 @@ option java_outer_classname = "YandexQueryInternalProtos"; import "ydb/library/yql/providers/dq/api/protos/service.proto"; import "ydb/library/yql/dq/proto/dq_tasks.proto"; +import "ydb/public/api/protos/ydb_issue_message.proto"; import "ydb/public/api/protos/yq.proto"; import "ydb/core/yq/libs/protos/fq_private.proto"; @@ -38,6 +39,7 @@ message QueryInternal { Fq.Private.CompressedData plan_compressed = 19; repeated Fq.Private.CompressedData dq_graph_compressed = 20; Fq.Private.TaskResources resources = 21; + repeated Ydb.Issue.IssueMessage internal_issue = 22; } message JobInternal { diff --git a/ydb/core/yq/libs/control_plane_storage/util.cpp b/ydb/core/yq/libs/control_plane_storage/util.cpp index f32f8b8be5..e2095339e7 100644 --- a/ydb/core/yq/libs/control_plane_storage/util.cpp +++ b/ydb/core/yq/libs/control_plane_storage/util.cpp @@ -169,6 +169,7 @@ bool DoesPingTaskUpdateQueriesTable(const Fq::Private::PingTaskRequest& request) || request.state_load_mode() || request.has_disposition() || request.has_resources() + || !request.internal_issues().empty() ; } diff --git a/ydb/core/yq/libs/protos/fq_private.proto b/ydb/core/yq/libs/protos/fq_private.proto index f463a373cc..e520cbf90a 100644 --- a/ydb/core/yq/libs/protos/fq_private.proto +++ b/ydb/core/yq/libs/protos/fq_private.proto @@ -149,6 +149,7 @@ message PingTaskRequest { google.protobuf.Timestamp deadline = 103; string tenant = 104; TaskResources resources = 33; + repeated Ydb.Issue.IssueMessage internal_issues = 34; } message PingTaskResult { |