diff options
author | Vitalii Gridnev <gridnevvvit@gmail.com> | 2022-06-09 15:10:47 +0300 |
---|---|---|
committer | Vitalii Gridnev <gridnevvvit@gmail.com> | 2022-06-09 15:10:47 +0300 |
commit | 7472de7a1fc3dadb0dedbbbe713cdc4cd7a32d0c (patch) | |
tree | 0307cecb2e5731dfbb03a0ef8e2d9f47901e1465 | |
parent | 0e7645a1547e5ac0e618721fa207c35ee444c247 (diff) | |
download | ydb-7472de7a1fc3dadb0dedbbbe713cdc4cd7a32d0c.tar.gz |
[kqp] cleanup code: add special function to find scheme error in issues KIKIMR-15042
ref:4fa7728b37d8b7f0e2818fca58cebba20c585ee0
4 files changed, 29 insertions, 23 deletions
diff --git a/ydb/core/kqp/compute_actor/kqp_compute_actor.h b/ydb/core/kqp/compute_actor/kqp_compute_actor.h index 399dbcbad3..6f26a4830a 100644 --- a/ydb/core/kqp/compute_actor/kqp_compute_actor.h +++ b/ydb/core/kqp/compute_actor/kqp_compute_actor.h @@ -41,6 +41,8 @@ enum class EShardState : ui32 { std::string_view EShardStateToString(EShardState state); +bool FindSchemeErrorInIssues(const Ydb::StatusIds::StatusCode& status, const NYql::TIssues& issues); + // scan over datashards struct TShardState { ui64 TabletId; diff --git a/ydb/core/kqp/compute_actor/kqp_compute_actor_helpers.cpp b/ydb/core/kqp/compute_actor/kqp_compute_actor_helpers.cpp index ac5f402b47..5e9e49250d 100644 --- a/ydb/core/kqp/compute_actor/kqp_compute_actor_helpers.cpp +++ b/ydb/core/kqp/compute_actor/kqp_compute_actor_helpers.cpp @@ -1,6 +1,7 @@ #include "kqp_compute_actor.h" #include <ydb/core/base/appdata.h> +#include <ydb/library/yql/core/issue/yql_issue.h> namespace NKikimr::NKqp::NComputeActor { @@ -91,4 +92,24 @@ const TSmallVec<TSerializedTableRange> TShardState::GetScanRanges(TConstArrayRef return ranges; } + +bool FindSchemeErrorInIssues(const Ydb::StatusIds::StatusCode& status, const NYql::TIssues& issues) { + bool schemeError = false; + if (status == Ydb::StatusIds::SCHEME_ERROR) { + schemeError = true; + } else if (status == Ydb::StatusIds::ABORTED) { + for (auto& issue : issues) { + WalkThroughIssues(issue, false, [&schemeError](const NYql::TIssue& x, ui16) { + if (x.IssueCode == NYql::TIssuesIds::KIKIMR_SCHEME_MISMATCH) { + schemeError = true; + } + }); + if (schemeError) { + break; + } + } + } + return schemeError; } + +} // namespace NKikimr::NKqp::NComputeActor diff --git a/ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp b/ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp index 4c867b6b30..b3b57f8baf 100644 --- a/ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp +++ b/ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp @@ -450,24 +450,7 @@ private: CA_LOG_W("Got EvScanError while starting scan, status: " << Ydb::StatusIds_StatusCode_Name(status) << ", reason: " << issues.ToString()); - bool schemeError = false; - - if (status == Ydb::StatusIds::SCHEME_ERROR) { - schemeError = true; - } else if (status == Ydb::StatusIds::ABORTED) { - for (auto& issue : issues) { - WalkThroughIssues(issue, false, [&schemeError](const TIssue& x, ui16) { - if (x.IssueCode == TIssuesIds::KIKIMR_SCHEME_MISMATCH) { - schemeError = true; - } - }); - if (schemeError) { - break; - } - } - } - - if (schemeError) { + if (FindSchemeErrorInIssues(status, issues)) { ResolveShard(state); return; } diff --git a/ydb/core/tx/datashard/datashard_ut_kqp_scan.cpp b/ydb/core/tx/datashard/datashard_ut_kqp_scan.cpp index fbc1a745b7..f059e5eb1c 100644 --- a/ydb/core/tx/datashard/datashard_ut_kqp_scan.cpp +++ b/ydb/core/tx/datashard/datashard_ut_kqp_scan.cpp @@ -27,13 +27,13 @@ namespace { } void EnableLogging(TTestActorRuntime& runtime) { - // runtime.SetLogPriority(NKikimrServices::KQP_YQL, NLog::PRI_DEBUG); + runtime.SetLogPriority(NKikimrServices::KQP_YQL, NLog::PRI_DEBUG); runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_DEBUG); - //runtime.SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_DEBUG); + runtime.SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_DEBUG); runtime.SetLogPriority(NKikimrServices::KQP_EXECUTER, NActors::NLog::PRI_TRACE); - //runtime.SetLogPriority(NKikimrServices::KQP_WORKER, NActors::NLog::PRI_DEBUG); - //runtime.SetLogPriority(NKikimrServices::KQP_RESOURCE_MANAGER, NActors::NLog::PRI_DEBUG); - //runtime.SetLogPriority(NKikimrServices::KQP_NODE, NActors::NLog::PRI_DEBUG); + runtime.SetLogPriority(NKikimrServices::KQP_WORKER, NActors::NLog::PRI_DEBUG); + runtime.SetLogPriority(NKikimrServices::KQP_RESOURCE_MANAGER, NActors::NLog::PRI_DEBUG); + runtime.SetLogPriority(NKikimrServices::KQP_NODE, NActors::NLog::PRI_DEBUG); runtime.SetLogPriority(NKikimrServices::KQP_COMPUTE, NActors::NLog::PRI_TRACE); } |