@@ -133,7 +133,6 @@ class TTableStatsCoroBuilder : public TActorCoroImpl, private IPages {
133
133
134
134
auto ev = MakeHolder<TDataShard::TEvPrivate::TEvAsyncTableStats>();
135
135
ev->TableId = TableId;
136
- ev->IndexSize = IndexSize;
137
136
ev->StatsUpdateTime = StatsUpdateTime;
138
137
ev->PartCount = Subset->Flatten .size () + Subset->ColdParts .size ();
139
138
ev->MemRowCount = MemRowCount;
@@ -272,17 +271,14 @@ class TDataShard::TTxGetTableStats : public NTabletFlatExecutor::TTransactionBas
272
271
273
272
const TUserTable& tableInfo = *Self->TableInfos [tableId];
274
273
275
- auto indexSize = txc. DB . GetTableIndexSize (tableInfo. LocalTid );
274
+ // Fill stats with current mem table size:
276
275
auto memSize = txc.DB .GetTableMemSize (tableInfo.LocalTid );
277
276
auto memRowCount = txc.DB .GetTableMemRowCount (tableInfo.LocalTid );
278
-
279
277
if (tableInfo.ShadowTid ) {
280
- indexSize += txc.DB .GetTableIndexSize (tableInfo.ShadowTid );
281
278
memSize += txc.DB .GetTableMemSize (tableInfo.ShadowTid );
282
279
memRowCount += txc.DB .GetTableMemRowCount (tableInfo.ShadowTid );
283
280
}
284
281
285
- Result->Record .MutableTableStats ()->SetIndexSize (indexSize);
286
282
Result->Record .MutableTableStats ()->SetInMemSize (memSize);
287
283
Result->Record .MutableTableStats ()->SetLastAccessTime (tableInfo.Stats .AccessTime .MilliSeconds ());
288
284
Result->Record .MutableTableStats ()->SetLastUpdateTime (tableInfo.Stats .UpdateTime .MilliSeconds ());
@@ -291,18 +287,21 @@ class TDataShard::TTxGetTableStats : public NTabletFlatExecutor::TTransactionBas
291
287
tableInfo.Stats .RowCountResolution = Ev->Get ()->Record .GetRowCountResolution ();
292
288
tableInfo.Stats .HistogramBucketsCount = Ev->Get ()->Record .GetHistogramBucketsCount ();
293
289
294
- // Check if first stats update has been completed
290
+ // Check if first stats update has been completed:
295
291
bool ready = (tableInfo.Stats .StatsUpdateTime != TInstant ());
296
292
Result->Record .SetFullStatsReady (ready);
297
- if (!ready)
293
+ if (!ready) {
298
294
return true ;
295
+ }
299
296
300
297
const TStats& stats = tableInfo.Stats .DataStats ;
298
+ Result->Record .MutableTableStats ()->SetIndexSize (stats.IndexSize .Size );
299
+ Result->Record .MutableTableStats ()->SetByKeyFilterSize (stats.ByKeyFilterSize );
301
300
Result->Record .MutableTableStats ()->SetDataSize (stats.DataSize .Size + memSize);
302
301
Result->Record .MutableTableStats ()->SetRowCount (stats.RowCount + memRowCount);
303
302
FillHistogram (stats.DataSizeHistogram , *Result->Record .MutableTableStats ()->MutableDataSizeHistogram ());
304
303
FillHistogram (stats.RowCountHistogram , *Result->Record .MutableTableStats ()->MutableRowCountHistogram ());
305
- // Fill key access sample if it was collected not too long ago
304
+ // Fill key access sample if it was collected not too long ago:
306
305
if (Self->StopKeyAccessSamplingAt + TDuration::Seconds (30 ) >= AppData (ctx)->TimeProvider ->Now ()) {
307
306
FillKeyAccessSample (tableInfo.Stats .AccessStats , *Result->Record .MutableTableStats ()->MutableKeyAccessSample ());
308
307
}
@@ -317,7 +316,7 @@ class TDataShard::TTxGetTableStats : public NTabletFlatExecutor::TTransactionBas
317
316
Result->Record .AddUserTablePartOwners (pi );
318
317
}
319
318
320
- for (const auto & pi : Self->SysTablesPartOnwers ) {
319
+ for (const auto & pi : Self->SysTablesPartOwners ) {
321
320
Result->Record .AddSysTablesPartOwners (pi );
322
321
}
323
322
@@ -375,9 +374,10 @@ void TDataShard::Handle(TEvPrivate::TEvAsyncTableStats::TPtr& ev, const TActorCo
375
374
LOG_ERROR (ctx, NKikimrServices::TX_DATASHARD,
376
375
" Unexpected async stats update at datashard %" PRIu64, TabletID ());
377
376
}
378
- tableInfo.Stats .Update (std::move (ev->Get ()->Stats ), ev->Get ()->IndexSize ,
379
- std::move (ev->Get ()->PartOwners ), ev->Get ()->PartCount ,
380
- ev->Get ()->StatsUpdateTime );
377
+ tableInfo.Stats .DataStats = std::move (ev->Get ()->Stats );
378
+ tableInfo.Stats .PartOwners = std::move (ev->Get ()->PartOwners );
379
+ tableInfo.Stats .PartCount = ev->Get ()->PartCount ;
380
+ tableInfo.Stats .StatsUpdateTime = ev->Get ()->StatsUpdateTime ;
381
381
tableInfo.Stats .MemRowCount = ev->Get ()->MemRowCount ;
382
382
tableInfo.Stats .MemDataSize = ev->Get ()->MemDataSize ;
383
383
@@ -565,12 +565,12 @@ class TDataShard::TTxInitiateStatsUpdate : public NTabletFlatExecutor::TTransact
565
565
Self->Actors .insert (actorId);
566
566
}
567
567
568
- Self->SysTablesPartOnwers .clear ();
568
+ Self->SysTablesPartOwners .clear ();
569
569
for (ui32 sysTableId : Self->SysTablesToTransferAtSplit ) {
570
570
THashSet<ui64> sysPartOwners;
571
571
auto subset = txc.DB .Subset (sysTableId, TEpoch::Max (), { }, { });
572
572
GetPartOwners (*subset, sysPartOwners);
573
- Self->SysTablesPartOnwers .insert (sysPartOwners.begin (), sysPartOwners.end ());
573
+ Self->SysTablesPartOwners .insert (sysPartOwners.begin (), sysPartOwners.end ());
574
574
}
575
575
return true ;
576
576
}
0 commit comments