Skip to content

Commit d56beea

Browse files
Fix comp nodes logging in case when it's disabled (#16837)
1 parent 5cc3ce6 commit d56beea

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

ydb/core/kqp/ut/runtime/kqp_scan_logging_ut.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ void FillTableWithData(NQuery::TQueryClient& db, ui64 numRows=300) {
3131
}
3232
}
3333

34-
void RunTestForQuery(const std::string& query, const std::string& expectedLog) {
34+
void RunTestForQuery(const std::string& query, const std::string& expectedLog, bool enabledLogs) {
3535
TStringStream logsStream;
3636

3737
Cerr << "cwd: " << NFs::CurrentWorkingDirectory() << Endl;
3838
TKikimrRunner kikimr(AppSettings(logsStream));
3939

40-
kikimr.GetTestServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_TASKS_RUNNER, NActors::NLog::PRI_DEBUG);
40+
if (enabledLogs) {
41+
kikimr.GetTestServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_TASKS_RUNNER, NActors::NLog::PRI_DEBUG);
42+
}
4143

4244
auto db = kikimr.GetQueryClient();
4345

@@ -64,25 +66,27 @@ void RunTestForQuery(const std::string& query, const std::string& expectedLog) {
6466
break;
6567
}
6668
}
67-
// TODO: Uncomment after: https://github.com/ydb-platform/ydb/issues/15597
68-
Y_UNUSED(hasExpectedLog);
69-
// UNIT_ASSERT(hasExpectedLog);
69+
70+
// TODO: remove this if after https://github.com/ydb-platform/ydb/issues/15597
71+
if (!enabledLogs) {
72+
UNIT_ASSERT(hasExpectedLog == enabledLogs);
73+
}
7074
}
7175

7276
} // anonymous namespace
7377

7478
Y_UNIT_TEST_SUITE(KqpScanLogs) {
7579

76-
Y_UNIT_TEST(WideCombine) {
80+
Y_UNIT_TEST_TWIN(WideCombine, EnabledLogs) {
7781
auto query = R"(
7882
--!syntax_v1
7983
select count(t.Key) from `/Root/KeyValue` as t group by t.Value
8084
)";
8185

82-
RunTestForQuery(query, "[WideCombine]");
86+
RunTestForQuery(query, "[WideCombine]", EnabledLogs);
8387
}
8488

85-
Y_UNIT_TEST(GraceJoin) {
89+
Y_UNIT_TEST_TWIN(GraceJoin, EnabledLogs) {
8690
auto query = R"(
8791
--!syntax_v1
8892
PRAGMA ydb.CostBasedOptimizationLevel='0';
@@ -92,7 +96,7 @@ Y_UNIT_TEST(GraceJoin) {
9296
order by t1.Value
9397
)";
9498

95-
RunTestForQuery(query, "[GraceJoin]");
99+
RunTestForQuery(query, "[GraceJoin]", EnabledLogs);
96100
}
97101

98102

ydb/library/yql/dq/runtime/dq_tasks_runner.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,8 @@ class TDqTaskRunner : public IDqTaskRunner {
264264
logProviderFunc = [log=LogFunc](const NUdf::TStringRef& component, NUdf::ELogLevel level, const NUdf::TStringRef& message) {
265265
log(TStringBuilder() << "[" << component << "][" << level << "]: " << message << "\n");
266266
};
267+
ComputationLogProvider = NUdf::MakeLogProvider(std::move(logProviderFunc), NUdf::ELogLevel::Debug);
267268
}
268-
269-
ComputationLogProvider = NUdf::MakeLogProvider(std::move(logProviderFunc), NUdf::ELogLevel::Debug);
270269
}
271270

272271
~TDqTaskRunner() {

0 commit comments

Comments
 (0)