diff options
author | ilnaz <ilnaz@ydb.tech> | 2022-11-30 15:37:39 +0300 |
---|---|---|
committer | ilnaz <ilnaz@ydb.tech> | 2022-11-30 15:37:39 +0300 |
commit | c31be11d81d8c2ade5fe8088e7ce7f87f617703e (patch) | |
tree | 2091af18d7bebfb58dafb4d8ae260a9b0f90e51d | |
parent | 37ac01ae0477d78543b88ed2d338d87e4dc77dbd (diff) | |
download | ydb-c31be11d81d8c2ade5fe8088e7ce7f87f617703e.tar.gz |
Prevent 'CheckCounters' test from hanging
Частичный откат изменений из https://a.yandex-team.ru/review/3154700
-rw-r--r-- | ydb/core/sys_view/processor/tx_init_schema.cpp | 2 | ||||
-rw-r--r-- | ydb/core/sys_view/service/sysview_service.cpp | 13 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/ut_helpers/test_env.cpp | 1 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/ut_helpers/test_env.h | 1 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/ut_ttl.cpp | 7 |
5 files changed, 16 insertions, 8 deletions
diff --git a/ydb/core/sys_view/processor/tx_init_schema.cpp b/ydb/core/sys_view/processor/tx_init_schema.cpp index 4e1ed9f6cc..8a1df28d68 100644 --- a/ydb/core/sys_view/processor/tx_init_schema.cpp +++ b/ydb/core/sys_view/processor/tx_init_schema.cpp @@ -40,7 +40,7 @@ struct TSysViewProcessor::TTxInitSchema : public TTxBase { void Complete(const TActorContext& ctx) override { SVLOG_D("[" << Self->TabletID() << "] TTxInitSchema::Complete"); - if (!AppData()->FeatureFlags.GetEnableSystemViews()) { + if (!AppData()->FeatureFlags.GetEnablePersistentQueryStats()) { SVLOG_D("[" << Self->TabletID() << "] tablet is offline"); Self->SignalTabletActive(ctx); Self->Become(&TThis::StateOffline); diff --git a/ydb/core/sys_view/service/sysview_service.cpp b/ydb/core/sys_view/service/sysview_service.cpp index 76995c0c99..92e826cd7f 100644 --- a/ydb/core/sys_view/service/sysview_service.cpp +++ b/ydb/core/sys_view/service/sysview_service.cpp @@ -348,8 +348,10 @@ public: ScanLimiter = MakeIntrusive<TScanLimiter>(ConcurrentScansLimit); - IntervalEnd = GetNextIntervalEnd(); - Schedule(IntervalEnd, new TEvPrivate::TEvProcessInterval(IntervalEnd)); + if (AppData()->FeatureFlags.GetEnablePersistentQueryStats()) { + IntervalEnd = GetNextIntervalEnd(); + Schedule(IntervalEnd, new TEvPrivate::TEvProcessInterval(IntervalEnd)); + } if (AppData()->FeatureFlags.GetEnableDbCounters()) { auto intervalSize = ProcessCountersInterval.MicroSeconds(); @@ -666,6 +668,11 @@ private: void Handle(TEvSysView::TEvGetIntervalMetricsRequest::TPtr& ev) { auto response = MakeHolder<TEvSysView::TEvGetIntervalMetricsResponse>(); + if (!AppData()->FeatureFlags.GetEnablePersistentQueryStats()) { + Send(ev->Sender, std::move(response), 0, ev->Cookie); + return; + } + const auto& record = ev->Get()->Record; response->Record.SetIntervalEndUs(record.GetIntervalEndUs()); const auto& database = record.GetDatabase(); @@ -909,7 +916,7 @@ private: << ", query hash# " << stats->GetQueryTextHash() << ", cpu time# " << stats->GetTotalCpuTimeUs()); - if (!database.empty()) { + if (AppData()->FeatureFlags.GetEnablePersistentQueryStats() && !database.empty()) { auto queryEnd = TInstant::MilliSeconds(stats->GetEndTimeMs()); if (queryEnd < IntervalEnd - TotalInterval) { return; diff --git a/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp b/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp index c5cb441a56..cbf70ee116 100644 --- a/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp +++ b/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp @@ -496,6 +496,7 @@ NSchemeShardUT_Private::TTestEnv::TTestEnv(TTestActorRuntime& runtime, const TTe app.SetEnableDataColumnForIndexTable(true); app.SetEnableSystemViews(opts.EnableSystemViews_); + app.SetEnablePersistentQueryStats(opts.EnablePersistentQueryStats_); app.SetEnablePersistentPartitionStats(opts.EnablePersistentPartitionStats_); app.SetAllowUpdateChannelsBindingOfSolomonPartitions(opts.AllowUpdateChannelsBindingOfSolomonPartitions_); app.SetEnableNotNullColumns(opts.EnableNotNullColumns_); diff --git a/ydb/core/tx/schemeshard/ut_helpers/test_env.h b/ydb/core/tx/schemeshard/ut_helpers/test_env.h index dd3af44cd5..638d3d40eb 100644 --- a/ydb/core/tx/schemeshard/ut_helpers/test_env.h +++ b/ydb/core/tx/schemeshard/ut_helpers/test_env.h @@ -33,6 +33,7 @@ namespace NSchemeShardUT_Private { OPTION(ui32, NChannels, 4); OPTION(bool, EnablePipeRetries, true); OPTION(std::optional<bool>, EnableSystemViews, std::nullopt); + OPTION(std::optional<bool>, EnablePersistentQueryStats, std::nullopt); OPTION(std::optional<bool>, EnablePersistentPartitionStats, std::nullopt); OPTION(std::optional<bool>, AllowUpdateChannelsBindingOfSolomonPartitions, std::nullopt); OPTION(std::optional<bool>, EnableNotNullColumns, std::nullopt); diff --git a/ydb/core/tx/schemeshard/ut_ttl.cpp b/ydb/core/tx/schemeshard/ut_ttl.cpp index 4c9ac4a03d..7dc846f260 100644 --- a/ydb/core/tx/schemeshard/ut_ttl.cpp +++ b/ydb/core/tx/schemeshard/ut_ttl.cpp @@ -886,10 +886,9 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) { Y_UNIT_TEST(CheckCounters) { TTestBasicRuntime runtime; - TTestEnvOptions opts; - opts.DisableStatsBatching(true); - - TTestEnv env(runtime, opts); + TTestEnv env(runtime, TTestEnvOptions() + .EnablePersistentQueryStats(false) + .DisableStatsBatching(true)); ui64 txId = 100; runtime.UpdateCurrentTime(TInstant::Now()); |