Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send datasize stats by channel along with total #11675

Merged
merged 1 commit into from
Nov 18, 2024
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
4 changes: 4 additions & 0 deletions ydb/core/tx/columnshard/common/blob.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ class TUnifiedBlobId {
return Id.BlobId.BlobSize();
}

ui32 Channel() const {
return Id.BlobId.Channel();
}

TLogoBlobID GetLogoBlobId() const {
return Id.BlobId;
}
Expand Down
8 changes: 8 additions & 0 deletions ydb/core/tx/columnshard/counters/aggregation/table_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ class TTableStatsBuilder {
auto activeStats = ColumnEngine.GetTotalStats().Active();
tableStats.SetRowCount(activeStats.Rows);
tableStats.SetDataSize(activeStats.Bytes);
for (ui32 ch = 0; ch < activeStats.ByChannel.size(); ch++) {
ui64 dataSize = activeStats.ByChannel[ch];
if (dataSize > 0) {
auto item = tableStats.AddChannels();
item->SetChannel(ch);
item->SetDataSize(dataSize);
}
}
}
};

Expand Down
11 changes: 11 additions & 0 deletions ydb/core/tx/columnshard/engines/column_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class TColumnEngineStats {
i64 Rows = 0;
i64 Bytes = 0;
i64 RawBytes = 0;
std::vector<i64> ByChannel;

TString DebugString() const {
return TStringBuilder() << "portions=" << Portions << ";blobs=" << Blobs << ";rows=" << Rows << ";bytes=" << Bytes
Expand All @@ -91,6 +92,10 @@ class TColumnEngineStats {
result.Rows = kff * Rows;
result.Bytes = kff * Bytes;
result.RawBytes = kff * RawBytes;
result.ByChannel.reserve(ByChannel.size());
for (ui64 channelBytes: ByChannel) {
result.ByChannel.push_back(channelBytes * kff);
}
return result;
}

Expand All @@ -104,6 +109,12 @@ class TColumnEngineStats {
Rows = SumVerifiedPositive(Rows, item.Rows);
Bytes = SumVerifiedPositive(Bytes, item.Bytes);
RawBytes = SumVerifiedPositive(RawBytes, item.RawBytes);
if (ByChannel.size() < item.ByChannel.size()) {
ByChannel.resize(item.ByChannel.size());
}
for (ui32 ch = 0; ch < item.ByChannel.size(); ch++) {
ByChannel[ch] = SumVerifiedPositive(ByChannel[ch], item.ByChannel[ch]);
}
return *this;
}
};
Expand Down
13 changes: 13 additions & 0 deletions ydb/core/tx/columnshard/engines/column_engine_logs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ void TColumnEngineForLogs::UpdatePortionStats(
TColumnEngineStats& engineStats, const TPortionInfo& portionInfo, EStatsUpdateType updateType, const TPortionInfo* exPortionInfo) const {
TColumnEngineStats::TPortionsStats deltaStats = DeltaStats(portionInfo);

ui64 totalBlobsSize = 0;
ui32 blobCount = portionInfo.GetBlobIdsCount();
for (ui32 i = 0; i < blobCount; i++) {
const auto& blob = portionInfo.GetBlobId(i);
ui32 channel = blob.Channel();
if (deltaStats.ByChannel.size() <= channel) {
deltaStats.ByChannel.resize(channel + 1);
}
deltaStats.ByChannel[channel] += blob.BlobSize();
totalBlobsSize += blob.BlobSize();
}
AFL_DEBUG(NKikimrServices::TX_COLUMNSHARD)("event", "update_portion")("blobs_size", totalBlobsSize)("portion_bytes", deltaStats.Bytes)("portion_raw_bytes", deltaStats.RawBytes);

Y_ABORT_UNLESS(!exPortionInfo || exPortionInfo->GetMeta().Produced != TPortionMeta::EProduced::UNSPECIFIED);
Y_ABORT_UNLESS(portionInfo.GetMeta().Produced != TPortionMeta::EProduced::UNSPECIFIED);

Expand Down
Loading