Skip to content

Commit 5f731ba

Browse files
va-kuznecovVlad Kuznecov
andauthored
Reduce huge amount of PDisk's chunks info printed into log (#8699)
Co-authored-by: Vlad Kuznecov <va-kuznecov@nebius.com>
1 parent 55fc639 commit 5f731ba

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,28 @@ bool TPDisk::ProcessChunk0(const NPDisk::TEvReadLogResult &readLogResult, TStrin
474474
return true;
475475
}
476476

477+
static void PrintCondensedChunksList(TStringStream& str, const std::vector<ui32>& chunks) {
478+
str << " [";
479+
bool first = true;
480+
std::optional<TChunkIdx> begin;
481+
for (size_t i = 0; i < chunks.size(); ++i) {
482+
if (!begin) {
483+
begin = chunks[i];
484+
}
485+
if (i + 1 < chunks.size() && chunks[i] + 1 == chunks[i + 1]) {
486+
continue;
487+
}
488+
str << (std::exchange(first, false) ? "" : " ");
489+
if (*begin == chunks[i]) {
490+
str << chunks[i];
491+
} else {
492+
str << *begin << "-" << chunks[i];
493+
}
494+
begin.reset();
495+
}
496+
str << "];";
497+
}
498+
477499
void TPDisk::PrintChunksDebugInfo() {
478500
auto print = [&] () {
479501
std::map<TOwner, std::vector<ui32>> ownerToChunks;
@@ -487,17 +509,13 @@ void TPDisk::PrintChunksDebugInfo() {
487509
str << "PDiskId# " << PDiskId << " PrintChunksDebugInfo; ";
488510
for (auto& [owner, chunks] : ownerToChunks) {
489511
std::sort(chunks.begin(), chunks.end());
490-
str << " Owner# " << owner << " [";
491-
bool first = true;
492-
for (auto idx : chunks) {
493-
str << (std::exchange(first, false) ? "" : " ") << idx;
494-
}
495-
str << "];";
512+
str << " Owner# " << owner;
513+
PrintCondensedChunksList(str, chunks);
496514
}
497515
return str.Str();
498516
};
499517

500-
LOG_INFO_S(*ActorSystem, NKikimrServices::BS_PDISK, print());
518+
LOG_DEBUG_S(*ActorSystem, NKikimrServices::BS_PDISK, print());
501519
}
502520

503521
TRcBuf TPDisk::ProcessReadSysLogResult(ui64 &outWritePosition, ui64 &outLsn,

0 commit comments

Comments
 (0)