Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ydb/core/tx/schemeshard/olap/store/store.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ struct TOlapStoreInfo {

ILayoutPolicy::TPtr GetTablesLayoutPolicy() const;

void UpdateShardStats(TShardIdx shardIdx, const TPartitionStats& newStats) {
void UpdateShardStats(TDiskSpaceUsageDelta* diskSpaceUsageDelta, TShardIdx shardIdx, const TPartitionStats& newStats, TInstant now) {
Stats.Aggregated.PartCount = ColumnShards.size();
Stats.PartitionStats[shardIdx]; // insert if none
Stats.UpdateShardStats(shardIdx, newStats);
Stats.UpdateShardStats(diskSpaceUsageDelta, shardIdx, newStats, now);
}
};

}
}
8 changes: 4 additions & 4 deletions ydb/core/tx/schemeshard/olap/table/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ struct TColumnTableInfo {
return Stats;
}

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

void UpdateTableStats(const TShardIdx shardIdx, const TPathId& pathId, const TPartitionStats& newStats) {
void UpdateTableStats(const TShardIdx shardIdx, const TPathId& pathId, const TPartitionStats& newStats, TInstant now) {
Stats.TableStats[pathId].Aggregated.PartCount = GetColumnShards().size();
Stats.UpdateTableStats(shardIdx, pathId, newStats);
Stats.UpdateTableStats(shardIdx, pathId, newStats, now);
}

TConclusion<std::shared_ptr<NOlap::NAlter::ISSEntity>> BuildEntity(const TPathId& pathId, const NOlap::NAlter::TEntityInitializationContext& iContext) const;
Expand Down
7 changes: 5 additions & 2 deletions ydb/core/tx/schemeshard/schemeshard__init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1845,6 +1845,8 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
}
}

tableInfo->IsExternalBlobsEnabled = PartitionConfigHasExternalBlobsEnabled(tableInfo->PartitionConfig());

TString alterTabletFull = std::get<4>(rec);
TString alterTabletDiff = std::get<5>(rec);
if (alterTabletFull) {
Expand Down Expand Up @@ -2384,6 +2386,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {

TPathId prevTableId;

TInstant now = AppData()->TimeProvider->Now();
while (!rowSet.EndOfSet()) {
const TPathId tableId = TPathId(
rowSet.GetValue<Schema::TablePartitionStats::TableOwnerId>(),
Expand Down Expand Up @@ -2460,7 +2463,6 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
stats.RangeReads = rowSet.GetValue<Schema::TablePartitionStats::RangeReads>();
stats.RangeReadRows = rowSet.GetValue<Schema::TablePartitionStats::RangeReadRows>();

TInstant now = AppData(ctx)->TimeProvider->Now();
stats.SetCurrentRawCpuUsage(rowSet.GetValue<Schema::TablePartitionStats::CPU>(), now);
stats.Memory = rowSet.GetValue<Schema::TablePartitionStats::Memory>();
stats.Network = rowSet.GetValue<Schema::TablePartitionStats::Network>();
Expand All @@ -2478,7 +2480,8 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
stats.LocksWholeShard = rowSet.GetValueOrDefault<Schema::TablePartitionStats::LocksWholeShard>();
stats.LocksBroken = rowSet.GetValueOrDefault<Schema::TablePartitionStats::LocksBroken>();

tableInfo->UpdateShardStats(shardIdx, stats);
TDiskSpaceUsageDelta unusedDelta;
tableInfo->UpdateShardStats(&unusedDelta, shardIdx, stats, now);

// note that we don't update shard metrics here, because we will always update
// the shard metrics in TSchemeShard::SetPartitioning
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/tx/schemeshard/schemeshard__pq_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ class TTxStoreTopicStats: public TTxStoreStats<TEvPersQueue::TEvPeriodicTopicSta
void Complete(const TActorContext& ) override;

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


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

TTopicStats newStats;
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/schemeshard/schemeshard__stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class TTxStoreStats: public NTabletFlatExecutor::TTransactionBase<TSchemeShard>
bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;

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

virtual void ScheduleNextBatch(const TActorContext& ctx) = 0;
};
Expand Down
3 changes: 2 additions & 1 deletion ydb/core/tx/schemeshard/schemeshard__stats_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,14 @@ bool TTxStoreStats<TEvent>::Execute(NTabletFlatExecutor::TTransactionContext& tx
return true;
}

TInstant now = AppData(ctx)->TimeProvider->Now();
TMonotonic start = TMonotonic::Now();
const ui32 maxBatchSize = Queue.MaxBatchSize();
ui32 batchSize = 0;
for (; batchSize < maxBatchSize && !Queue.Empty(); ++batchSize) {
auto item = Queue.Next();
Queue.WriteLatencyMetric(item);
if (!PersistSingleStats(item.PathId(), item, txc, ctx)) {
if (!PersistSingleStats(item.PathId(), item, now, txc, ctx)) {
break;
}

Expand Down
Loading
Loading