Skip to content

Commit 3c28b5a

Browse files
authored
Revert "25-2: schemeshard: stats processing opt 1" (#28838)
2 parents c86ec91 + 612677a commit 3c28b5a

File tree

11 files changed

+136
-196
lines changed

11 files changed

+136
-196
lines changed

ydb/core/tx/schemeshard/olap/store/store.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ struct TOlapStoreInfo {
147147

148148
ILayoutPolicy::TPtr GetTablesLayoutPolicy() const;
149149

150-
void UpdateShardStats(TDiskSpaceUsageDelta* diskSpaceUsageDelta, TShardIdx shardIdx, const TPartitionStats& newStats, TInstant now) {
150+
void UpdateShardStats(TShardIdx shardIdx, const TPartitionStats& newStats) {
151151
Stats.Aggregated.PartCount = ColumnShards.size();
152152
Stats.PartitionStats[shardIdx]; // insert if none
153-
Stats.UpdateShardStats(diskSpaceUsageDelta, shardIdx, newStats, now);
153+
Stats.UpdateShardStats(shardIdx, newStats);
154154
}
155155
};
156156

157-
}
157+
}

ydb/core/tx/schemeshard/olap/table/table.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ struct TColumnTableInfo {
103103
return Stats;
104104
}
105105

106-
void UpdateShardStats(TDiskSpaceUsageDelta* diskSpaceUsageDelta, const TShardIdx shardIdx, const TPartitionStats& newStats, TInstant now) {
106+
void UpdateShardStats(const TShardIdx shardIdx, const TPartitionStats& newStats) {
107107
Stats.Aggregated.PartCount = GetColumnShards().size();
108108
Stats.PartitionStats[shardIdx]; // insert if none
109-
Stats.UpdateShardStats(diskSpaceUsageDelta, shardIdx, newStats, now);
109+
Stats.UpdateShardStats(shardIdx, newStats);
110110
}
111111

112-
void UpdateTableStats(TDiskSpaceUsageDelta* diskSpaceUsageDelta, const TShardIdx shardIdx, const TPathId& pathId, const TPartitionStats& newStats, TInstant now) {
112+
void UpdateTableStats(const TShardIdx shardIdx, const TPathId& pathId, const TPartitionStats& newStats) {
113113
Stats.TableStats[pathId].Aggregated.PartCount = GetColumnShards().size();
114-
Stats.UpdateTableStats(diskSpaceUsageDelta, shardIdx, pathId, newStats, now);
114+
Stats.UpdateTableStats(shardIdx, pathId, newStats);
115115
}
116116

117117
TConclusion<std::shared_ptr<NOlap::NAlter::ISSEntity>> BuildEntity(const TPathId& pathId, const NOlap::NAlter::TEntityInitializationContext& iContext) const;

ydb/core/tx/schemeshard/schemeshard__init.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,8 +1834,6 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
18341834
}
18351835
}
18361836

1837-
tableInfo->IsExternalBlobsEnabled = PartitionConfigHasExternalBlobsEnabled(tableInfo->PartitionConfig());
1838-
18391837
TString alterTabletFull = std::get<4>(rec);
18401838
TString alterTabletDiff = std::get<5>(rec);
18411839
if (alterTabletFull) {
@@ -2330,7 +2328,6 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
23302328

23312329
TPathId prevTableId;
23322330

2333-
TInstant now = AppData()->TimeProvider->Now();
23342331
while (!rowSet.EndOfSet()) {
23352332
const TPathId tableId = TPathId(
23362333
rowSet.GetValue<Schema::TablePartitionStats::TableOwnerId>(),
@@ -2407,6 +2404,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
24072404
stats.RangeReads = rowSet.GetValue<Schema::TablePartitionStats::RangeReads>();
24082405
stats.RangeReadRows = rowSet.GetValue<Schema::TablePartitionStats::RangeReadRows>();
24092406

2407+
TInstant now = AppData(ctx)->TimeProvider->Now();
24102408
stats.SetCurrentRawCpuUsage(rowSet.GetValue<Schema::TablePartitionStats::CPU>(), now);
24112409
stats.Memory = rowSet.GetValue<Schema::TablePartitionStats::Memory>();
24122410
stats.Network = rowSet.GetValue<Schema::TablePartitionStats::Network>();
@@ -2424,8 +2422,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
24242422
stats.LocksWholeShard = rowSet.GetValueOrDefault<Schema::TablePartitionStats::LocksWholeShard>();
24252423
stats.LocksBroken = rowSet.GetValueOrDefault<Schema::TablePartitionStats::LocksBroken>();
24262424

2427-
TDiskSpaceUsageDelta unusedDelta;
2428-
tableInfo->UpdateShardStats(&unusedDelta, shardIdx, stats, now);
2425+
tableInfo->UpdateShardStats(shardIdx, stats);
24292426

24302427
// note that we don't update shard metrics here, because we will always update
24312428
// the shard metrics in TSchemeShard::SetPartitioning

ydb/core/tx/schemeshard/schemeshard__pq_stats.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ class TTxStoreTopicStats: public TTxStoreStats<TEvPersQueue::TEvPeriodicTopicSta
2222
void Complete(const TActorContext& ) override;
2323

2424
// returns true to continue batching
25-
bool PersistSingleStats(const TPathId& pathId, const TStatsQueue<TEvPersQueue::TEvPeriodicTopicStats>::TItem& item, TInstant now, TTransactionContext& txc, const TActorContext& ctx) override;
25+
bool PersistSingleStats(const TPathId& pathId, const TStatsQueue<TEvPersQueue::TEvPeriodicTopicStats>::TItem& item, TTransactionContext& txc, const TActorContext& ctx) override;
2626
void ScheduleNextBatch(const TActorContext& ctx) override;
2727
};
2828

2929

30-
bool TTxStoreTopicStats::PersistSingleStats(const TPathId& pathId, const TStatsQueueItem<TEvPersQueue::TEvPeriodicTopicStats>& item, TInstant /*now*/, TTransactionContext& txc, const TActorContext& ctx) {
30+
bool TTxStoreTopicStats::PersistSingleStats(const TPathId& pathId, const TStatsQueueItem<TEvPersQueue::TEvPeriodicTopicStats>& item, TTransactionContext& txc, const TActorContext& ctx) {
3131
const auto& rec = item.Ev->Get()->Record;
3232

3333
TTopicStats newStats;

ydb/core/tx/schemeshard/schemeshard__stats.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class TTxStoreStats: public NTabletFlatExecutor::TTransactionBase<TSchemeShard>
122122
bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
123123

124124
// returns true to continue batching
125-
virtual bool PersistSingleStats(const TPathId& pathId, const TItem& item, TInstant now, TTransactionContext& txc, const TActorContext& ctx) = 0;
125+
virtual bool PersistSingleStats(const TPathId& pathId, const TItem& item, TTransactionContext& txc, const TActorContext& ctx) = 0;
126126

127127
virtual void ScheduleNextBatch(const TActorContext& ctx) = 0;
128128
};

ydb/core/tx/schemeshard/schemeshard__stats_impl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,13 @@ bool TTxStoreStats<TEvent>::Execute(NTabletFlatExecutor::TTransactionContext& tx
118118
return true;
119119
}
120120

121-
TInstant now = AppData(ctx)->TimeProvider->Now();
122121
TMonotonic start = TMonotonic::Now();
123122
const ui32 maxBatchSize = Queue.MaxBatchSize();
124123
ui32 batchSize = 0;
125124
for (; batchSize < maxBatchSize && !Queue.Empty(); ++batchSize) {
126125
auto item = Queue.Next();
127126
Queue.WriteLatencyMetric(item);
128-
if (!PersistSingleStats(item.PathId(), item, now, txc, ctx)) {
127+
if (!PersistSingleStats(item.PathId(), item, txc, ctx)) {
129128
break;
130129
}
131130

0 commit comments

Comments
 (0)