Skip to content

Commit c8af2fe

Browse files
authored
Statistics: Remove IsSchemeshardSeen, rely on persisted ScheduleTraversals (#8182)
1 parent 1704639 commit c8af2fe

File tree

5 files changed

+32
-8
lines changed

5 files changed

+32
-8
lines changed

ydb/core/statistics/aggregator/aggregator_impl.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,6 @@ TStatisticsAggregator::TForceTraversalOperation* TStatisticsAggregator::ForceTra
758758
}
759759

760760
std::optional<bool> TStatisticsAggregator::IsColumnTable(const TPathId& pathId) const {
761-
Y_ABORT_UNLESS(IsSchemeshardSeen);
762-
763761
auto itPath = ScheduleTraversals.find(pathId);
764762
if (itPath != ScheduleTraversals.end()) {
765763
bool ret = itPath->second.IsColumnTable;

ydb/core/statistics/aggregator/aggregator_impl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ class TStatisticsAggregator : public TActor<TStatisticsAggregator>, public NTabl
256256
std::queue<TEvStatistics::TEvRequestStats::TPtr> PendingRequests;
257257
bool ProcessUrgentInFlight = false;
258258

259-
bool IsSchemeshardSeen = false;
260259
bool IsStatisticsTableCreated = false;
261260
bool PendingSaveStatistics = false;
262261
bool PendingDeleteStatistics = false;

ydb/core/statistics/aggregator/tx_schedule_traversal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct TStatisticsAggregator::TTxScheduleTrasersal : public TTxBase {
2323
return true;
2424
}
2525

26-
if (!Self->IsSchemeshardSeen) {
26+
if (Self->ScheduleTraversals.empty()) {
2727
SA_LOG_T("[" << Self->TabletID() << "] TTxScheduleTrasersal. No info from schemeshard");
2828
return true;
2929
}

ydb/core/statistics/aggregator/tx_schemeshard_stats.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ struct TStatisticsAggregator::TTxSchemeShardStats : public TTxBase {
7676

7777
void Complete(const TActorContext&) override {
7878
SA_LOG_D("[" << Self->TabletID() << "] TTxSchemeShardStats::Complete");
79-
80-
Self->IsSchemeshardSeen = true;
8179
}
8280
};
8381

ydb/core/tx/schemeshard/schemeshard_impl.cpp

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7304,6 +7304,10 @@ void TSchemeShard::Handle(TEvSchemeShard::TEvLogin::TPtr &ev, const TActorContex
73047304
}
73057305

73067306
void TSchemeShard::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr& ev, const TActorContext&) {
7307+
LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::STATISTICS,
7308+
"Handle TEvTxProxySchemeCache::TEvNavigateKeySetResult"
7309+
<< ", at schemeshard: " << TabletID());
7310+
73077311
using TNavigate = NSchemeCache::TSchemeCacheNavigate;
73087312
std::unique_ptr<TNavigate> request(ev->Get()->Request.Release());
73097313
if (request->ResultSet.size() != 1) {
@@ -7316,12 +7320,18 @@ void TSchemeShard::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr&
73167320

73177321
if (entry.DomainInfo->Params.HasStatisticsAggregator()) {
73187322
StatisticsAggregatorId = TTabletId(entry.DomainInfo->Params.GetStatisticsAggregator());
7323+
LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::STATISTICS,
7324+
"Handle TEvTxProxySchemeCache::TEvNavigateKeySetResult, StatisticsAggregatorId=" << StatisticsAggregatorId
7325+
<< ", at schemeshard: " << TabletID());
73197326
ConnectToSA();
73207327
}
73217328
}
73227329

73237330
void TSchemeShard::Handle(TEvPrivate::TEvSendBaseStatsToSA::TPtr&, const TActorContext& ctx) {
73247331
TDuration delta = SendBaseStatsToSA();
7332+
LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::STATISTICS,
7333+
"Schedule next SendBaseStatsToSA in " << delta
7334+
<< ", at schemeshard: " << TabletID());
73257335
ctx.Schedule(delta, new TEvPrivate::TEvSendBaseStatsToSA());
73267336
}
73277337

@@ -7346,12 +7356,21 @@ void TSchemeShard::ResolveSA() {
73467356
Send(MakeSchemeCacheID(), new TEvTxProxySchemeCache::TEvNavigateKeySet(navigate.release()));
73477357
} else {
73487358
StatisticsAggregatorId = subDomainInfo->GetTenantStatisticsAggregatorID();
7359+
LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::STATISTICS,
7360+
"ResolveSA(), StatisticsAggregatorId=" << StatisticsAggregatorId
7361+
<< ", at schemeshard: " << TabletID());
73497362
ConnectToSA();
73507363
}
73517364
}
73527365

73537366
void TSchemeShard::ConnectToSA() {
7354-
if (!EnableStatistics || !StatisticsAggregatorId) {
7367+
if (!EnableStatistics)
7368+
return;
7369+
7370+
if (!StatisticsAggregatorId) {
7371+
LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::STATISTICS,
7372+
"ConnectToSA(), no StatisticsAggregatorId"
7373+
<< ", at schemeshard: " << TabletID());
73557374
return;
73567375
}
73577376
auto policy = NTabletPipe::TClientRetryPolicy::WithRetries();
@@ -7366,7 +7385,10 @@ void TSchemeShard::ConnectToSA() {
73667385
LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::STATISTICS,
73677386
"ConnectToSA()"
73687387
<< ", pipe client id: " << SAPipeClientId
7369-
<< ", at schemeshard: " << TabletID());
7388+
<< ", at schemeshard: " << TabletID()
7389+
<< ", StatisticsAggregatorId: " << StatisticsAggregatorId
7390+
<< ", at schemeshard: " << TabletID()
7391+
);
73707392
}
73717393

73727394
TDuration TSchemeShard::SendBaseStatsToSA() {
@@ -7377,7 +7399,14 @@ TDuration TSchemeShard::SendBaseStatsToSA() {
73777399
if (!SAPipeClientId) {
73787400
ResolveSA();
73797401
if (!StatisticsAggregatorId) {
7402+
LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::STATISTICS,
7403+
"SendBaseStatsToSA(), no StatisticsAggregatorId"
7404+
<< ", at schemeshard: " << TabletID());
73807405
return TDuration::Seconds(30);
7406+
} else {
7407+
LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::STATISTICS,
7408+
"SendBaseStatsToSA(), StatisticsAggregatorId=" << StatisticsAggregatorId
7409+
<< ", at schemeshard: " << TabletID());
73817410
}
73827411
}
73837412

0 commit comments

Comments
 (0)