aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidar Samerkhanov <aidarsamer@yandex-team.ru>2022-03-10 12:26:25 +0300
committerAidar Samerkhanov <aidarsamer@yandex-team.ru>2022-03-10 12:26:25 +0300
commit3b79bc88c6872b8f7e29ea81ce41948930059509 (patch)
tree74fe90496fdf7c937b05d9965a2748dc002b24f4
parent133d9d9cae39508f4a357477569fbbd5899bde76 (diff)
downloadydb-3b79bc88c6872b8f7e29ea81ce41948930059509.tar.gz
KIKIMR-13525. Fix total distribution time calculation.
KIKIMR-13525. Fix total duration calculation. ref:2f4a16abfe107a4960e3f29bfab83b71889024cc
-rw-r--r--build/mapping.conf.json6
-rwxr-xr-xya4
-rw-r--r--ydb/core/grpc_services/rpc_kqp_base.cpp4
-rw-r--r--ydb/core/kqp/ut/kqp_query_ut.cpp5
-rw-r--r--ydb/core/kqp/ut/kqp_scripting_ut.cpp5
-rw-r--r--ydb/services/ydb/ydb_table_ut.cpp15
6 files changed, 16 insertions, 23 deletions
diff --git a/build/mapping.conf.json b/build/mapping.conf.json
index 1d12820006..9d09f0eb7b 100644
--- a/build/mapping.conf.json
+++ b/build/mapping.conf.json
@@ -2973,6 +2973,12 @@
"2843823282": "https://storage.mds.yandex.net/get-devtools-opensource/471749/2843823282",
"2843823836": "https://storage.mds.yandex.net/get-devtools-opensource/471749/2843823836",
"2843824017": "https://storage.mds.yandex.net/get-devtools-opensource/233854/2843824017",
+ "2857175289": "https://storage.mds.yandex.net/get-devtools-opensource/250854/2857175289",
+ "2857177161": "https://storage.mds.yandex.net/get-devtools-opensource/471749/2857177161",
+ "2857178145": "https://storage.mds.yandex.net/get-devtools-opensource/471749/2857178145",
+ "2857211305": "https://storage.mds.yandex.net/get-devtools-opensource/233854/2857211305",
+ "2857212963": "https://storage.mds.yandex.net/get-devtools-opensource/233854/2857212963",
+ "2857213798": "https://storage.mds.yandex.net/get-devtools-opensource/250854/2857213798",
"309054781": "https://storage.mds.yandex.net/get-devtools-opensource/250854/309054781",
"360916612": "https://storage.mds.yandex.net/get-devtools-opensource/233854/360916612",
"412716868": "https://storage.mds.yandex.net/get-devtools-opensource/233854/412716868",
diff --git a/ya b/ya
index 0193f06fbe..a8e5ea81cb 100755
--- a/ya
+++ b/ya
@@ -4,8 +4,8 @@ import sys
import platform
import json
-URLS = ["https://storage.mds.yandex.net/get-devtools-opensource/233854/f850342577dbea709cf4bc3e50888639"]
-MD5 = "f850342577dbea709cf4bc3e50888639"
+URLS = ["https://storage.mds.yandex.net/get-devtools-opensource/233854/e87b00461af997f2a607a137c158fddc"]
+MD5 = "e87b00461af997f2a607a137c158fddc"
RETRIES = 5
HASH_PREFIX = 10
diff --git a/ydb/core/grpc_services/rpc_kqp_base.cpp b/ydb/core/grpc_services/rpc_kqp_base.cpp
index 414543f574..e8b393bc7d 100644
--- a/ydb/core/grpc_services/rpc_kqp_base.cpp
+++ b/ydb/core/grpc_services/rpc_kqp_base.cpp
@@ -9,13 +9,11 @@ void FillQueryStats(Ydb::TableStats::QueryStats& queryStats, const NKikimrKqp::T
const auto& kqpStats = kqpResponse.GetQueryStats();
uint64_t totalCpuTimeUs = 0;
- uint64_t totalDurationUs = 0;
for (auto& exec : kqpStats.GetExecutions()) {
auto durationUs = exec.GetDurationUs();
auto cpuTimeUs = exec.GetCpuTimeUs();
- totalDurationUs += durationUs;
totalCpuTimeUs += cpuTimeUs;
auto& toPhase = *queryStats.add_query_phases();
@@ -64,7 +62,7 @@ void FillQueryStats(Ydb::TableStats::QueryStats& queryStats, const NKikimrKqp::T
queryStats.set_process_cpu_time_us(kqpStats.GetWorkerCpuTimeUs());
queryStats.set_total_cpu_time_us(totalCpuTimeUs);
- queryStats.set_total_duration_us(totalDurationUs);
+ queryStats.set_total_duration_us(kqpStats.GetDurationUs());
queryStats.set_query_plan(kqpResponse.GetQueryPlan());
}
diff --git a/ydb/core/kqp/ut/kqp_query_ut.cpp b/ydb/core/kqp/ut/kqp_query_ut.cpp
index d2c7c29400..cf59d4071a 100644
--- a/ydb/core/kqp/ut/kqp_query_ut.cpp
+++ b/ydb/core/kqp/ut/kqp_query_ut.cpp
@@ -958,20 +958,17 @@ Y_UNIT_TEST_SUITE(KqpQuery) {
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), UseNewEngine ? 3 : 2);
- uint64_t totalDurationUs = 0;
uint64_t totalCpuTimeUs = 0;
if (UseNewEngine) {
auto& phase0 = stats.query_phases(0);
UNIT_ASSERT(phase0.table_access().size() == 0);
- totalDurationUs += phase0.duration_us();
totalCpuTimeUs += phase0.cpu_time_us();
}
auto& phase0 = stats.query_phases(UseNewEngine ? 1 : 0);
UNIT_ASSERT(phase0.duration_us() > 0);
UNIT_ASSERT(phase0.cpu_time_us() > 0);
- totalDurationUs += phase0.duration_us();
totalCpuTimeUs += phase0.cpu_time_us();
UNIT_ASSERT_VALUES_EQUAL(phase0.table_access().size(), 1);
@@ -984,7 +981,6 @@ Y_UNIT_TEST_SUITE(KqpQuery) {
auto& phase1 = stats.query_phases(UseNewEngine ? 2 : 1);
UNIT_ASSERT(phase1.duration_us() > 0);
UNIT_ASSERT(phase1.cpu_time_us() > 0);
- totalDurationUs += phase1.duration_us();
totalCpuTimeUs += phase1.cpu_time_us();
UNIT_ASSERT_VALUES_EQUAL(phase1.table_access().size(), UseNewEngine ? 1 : 2);
if (!UseNewEngine) {
@@ -999,7 +995,6 @@ Y_UNIT_TEST_SUITE(KqpQuery) {
UNIT_ASSERT(phase1.table_access(0).updates().bytes() > 0);
UNIT_ASSERT(!phase1.table_access(0).has_deletes());
- UNIT_ASSERT_VALUES_EQUAL(stats.total_duration_us(), totalDurationUs);
UNIT_ASSERT_VALUES_EQUAL(stats.total_cpu_time_us(), totalCpuTimeUs);
}
diff --git a/ydb/core/kqp/ut/kqp_scripting_ut.cpp b/ydb/core/kqp/ut/kqp_scripting_ut.cpp
index 65e75ac303..d05cef31c5 100644
--- a/ydb/core/kqp/ut/kqp_scripting_ut.cpp
+++ b/ydb/core/kqp/ut/kqp_scripting_ut.cpp
@@ -168,10 +168,10 @@ Y_UNIT_TEST_SUITE(KqpScripting) {
auto stats = NYdb::TProtoAccessor::GetProto(*result.GetStats());
UNIT_ASSERT(stats.process_cpu_time_us() > 0);
+ UNIT_ASSERT(stats.total_duration_us() > 0);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 4);
ui32 phaseNo = 0;
- uint64_t totalDurationUs = 0;
uint64_t totalCpuTimeUs = 0;
for (auto& phase : stats.query_phases()) {
@@ -179,7 +179,6 @@ Y_UNIT_TEST_SUITE(KqpScripting) {
UNIT_ASSERT_VALUES_EQUAL(phase.table_access().size(), 0);
UNIT_ASSERT(phase.cpu_time_us() > 0);
UNIT_ASSERT(phase.affected_shards() == 0);
- totalDurationUs += phase.duration_us();
totalCpuTimeUs += phase.cpu_time_us();
continue;
}
@@ -189,10 +188,8 @@ Y_UNIT_TEST_SUITE(KqpScripting) {
UNIT_ASSERT(phase.table_access(0).reads().bytes() > 0);
UNIT_ASSERT(phase.cpu_time_us() > 0);
UNIT_ASSERT(phase.affected_shards() > 0);
- totalDurationUs += phase.duration_us();
totalCpuTimeUs += phase.cpu_time_us();
}
- UNIT_ASSERT_VALUES_EQUAL(stats.total_duration_us(), totalDurationUs);
UNIT_ASSERT_VALUES_EQUAL(stats.total_cpu_time_us(), totalCpuTimeUs);
}
diff --git a/ydb/services/ydb/ydb_table_ut.cpp b/ydb/services/ydb/ydb_table_ut.cpp
index 31ce72b72a..0ed2b7f712 100644
--- a/ydb/services/ydb/ydb_table_ut.cpp
+++ b/ydb/services/ydb/ydb_table_ut.cpp
@@ -2872,7 +2872,7 @@ R"___(<main>: Error: Transaction not found: , code: 2015
UNIT_ASSERT(stats.query_phases(0).table_access(0).updates().bytes() > 1);
UNIT_ASSERT(stats.query_phases(0).cpu_time_us() > 0);
UNIT_ASSERT_VALUES_EQUAL(stats.total_cpu_time_us(), stats.query_phases(0).cpu_time_us());
- UNIT_ASSERT_VALUES_EQUAL(stats.total_duration_us(), stats.query_phases(0).duration_us());
+ UNIT_ASSERT(stats.total_duration_us() > 0);
} else {
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases().size(), 2);
UNIT_ASSERT_VALUES_EQUAL(stats.query_phases(1).table_access().size(), 1);
@@ -2881,7 +2881,7 @@ R"___(<main>: Error: Transaction not found: , code: 2015
UNIT_ASSERT(stats.query_phases(1).table_access(0).updates().bytes() > 1);
UNIT_ASSERT(stats.query_phases(1).cpu_time_us() > 0);
UNIT_ASSERT_VALUES_EQUAL(stats.total_cpu_time_us(), stats.query_phases(0).cpu_time_us() + stats.query_phases(1).cpu_time_us());
- UNIT_ASSERT_VALUES_EQUAL(stats.total_duration_us(), stats.query_phases(0).duration_us() + stats.query_phases(1).duration_us());
+ UNIT_ASSERT(stats.total_duration_us() > 0);
}
}
}
@@ -2905,8 +2905,7 @@ R"___(<main>: Error: Transaction not found: , code: 2015
UNIT_ASSERT(stats.query_phases(1).cpu_time_us() > 0);
UNIT_ASSERT_VALUES_EQUAL(stats.total_cpu_time_us(),
stats.query_phases(0).cpu_time_us() + stats.query_phases(1).cpu_time_us());
- UNIT_ASSERT_VALUES_EQUAL(stats.total_duration_us(),
- stats.query_phases(0).duration_us() + stats.query_phases(1).duration_us());
+ UNIT_ASSERT(stats.total_duration_us() > 0);
}
}
@@ -2928,7 +2927,7 @@ R"___(<main>: Error: Transaction not found: , code: 2015
UNIT_ASSERT(stats.query_phases(0).table_access(0).reads().bytes() > 3);
UNIT_ASSERT(stats.query_phases(0).cpu_time_us() > 0);
UNIT_ASSERT_VALUES_EQUAL(stats.total_cpu_time_us(), stats.query_phases(0).cpu_time_us());
- UNIT_ASSERT_VALUES_EQUAL(stats.total_duration_us(), stats.query_phases(0).duration_us());
+ UNIT_ASSERT(stats.total_duration_us() > 0);
}
}
@@ -2950,7 +2949,7 @@ R"___(<main>: Error: Transaction not found: , code: 2015
UNIT_ASSERT(stats.query_phases(0).table_access(0).reads().bytes() > 1);
UNIT_ASSERT(stats.query_phases(0).cpu_time_us() > 0);
UNIT_ASSERT_VALUES_EQUAL(stats.total_cpu_time_us(), stats.query_phases(0).cpu_time_us());
- UNIT_ASSERT_VALUES_EQUAL(stats.total_duration_us(), stats.query_phases(0).duration_us());
+ UNIT_ASSERT(stats.total_duration_us() > 0);
}
}
@@ -2987,13 +2986,11 @@ R"___(<main>: Error: Transaction not found: , code: 2015
UNIT_ASSERT(stats.query_phases(idx + 1).cpu_time_us() > 0);
// Totals
ui64 cpuTimeUs = 0;
- ui64 durationUs = 0;
for (const auto& phase: stats.query_phases()) {
cpuTimeUs += phase.cpu_time_us();
- durationUs += phase.duration_us();
}
UNIT_ASSERT_VALUES_EQUAL(stats.total_cpu_time_us(), cpuTimeUs);
- UNIT_ASSERT_VALUES_EQUAL(stats.total_duration_us(), durationUs);
+ UNIT_ASSERT(stats.total_duration_us() > 0);
}
}
}