Skip to content

KIKIMR-20042 Partially implemented PDisk tracing #574

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

Merged
merged 3 commits into from
Dec 26, 2023
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
19 changes: 12 additions & 7 deletions ydb/core/blobstorage/pdisk/blobstorage_pdisk.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,9 @@ struct TEvLog : public TEventLocal<TEvLog, TEvBlobStorage::EvLog> {
};

struct TEvMultiLog : public TEventLocal<TEvMultiLog, TEvBlobStorage::EvMultiLog> {
TBatchedVec<THolder<TEvLog>> Logs;
TLsnSeg LsnSeg;

void AddLog(THolder<TEvLog> &&ev) {
Logs.emplace_back(std::move(ev));
auto &log = *Logs.back();
void AddLog(THolder<TEvLog> &&ev, NWilson::TTraceId traceId = {}) {
Logs.emplace_back(std::move(ev), std::move(traceId));
auto &log = *Logs.back().Event;
if (Logs.size() == 1) {
LsnSeg = TLsnSeg(log.LsnSegmentStart, log.Lsn);
} else {
Expand All @@ -350,11 +347,19 @@ struct TEvMultiLog : public TEventLocal<TEvMultiLog, TEvBlobStorage::EvMultiLog>
TStringBuilder str;
str << '{';
for (ui64 idx = 0; idx < record.Logs.size(); ++idx) {
str << (idx ? ", " : "") << idx << "# " << record.Logs[idx]->ToString();
str << (idx ? ", " : "") << idx << "# " << record.Logs[idx].Event->ToString();
}
str << '}';
return str;
}

struct TItem {
THolder<TEvLog> Event;
NWilson::TTraceId TraceId;
};

TBatchedVec<TItem> Logs;
TLsnSeg LsnSeg;
};

struct TEvLogResult : public TEventLocal<TEvLogResult, TEvBlobStorage::EvLogResult> {
Expand Down
12 changes: 6 additions & 6 deletions ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ class TPDiskActor : public TActorBootstrapped<TPDiskActor> {
}
str << " StateErrorReason# " << StateErrorReason;
THolder<NPDisk::TEvLogResult> result(new NPDisk::TEvLogResult(NKikimrProto::CORRUPTED, 0, str.Str()));
for (auto &log : evMultiLog.Logs) {
for (auto &[log, _] : evMultiLog.Logs) {
result->Results.push_back(NPDisk::TEvLogResult::TRecord(log->Lsn, log->Cookie));
}
PDisk->Mon.WriteLog.CountRequest(0);
Expand Down Expand Up @@ -783,9 +783,9 @@ class TPDiskActor : public TActorBootstrapped<TPDiskActor> {
}

void Handle(NPDisk::TEvMultiLog::TPtr &ev) {
for (auto &log : ev->Get()->Logs) {
for (auto &[log, traceId] : ev->Get()->Logs) {
double burstMs;
TLogWrite* request = PDisk->ReqCreator.CreateLogWrite(*log, ev->Sender, burstMs, std::move(ev->TraceId));
TLogWrite* request = PDisk->ReqCreator.CreateLogWrite(*log, ev->Sender, burstMs, std::move(traceId));
CheckBurst(request->IsSensitive, burstMs);
request->Orbit = std::move(log->Orbit);
PDisk->InputRequest(request);
Expand All @@ -796,7 +796,7 @@ class TPDiskActor : public TActorBootstrapped<TPDiskActor> {
LOG_DEBUG(*TlsActivationContext, NKikimrServices::BS_PDISK, "PDiskId# %" PRIu32 " %s Marker# BSY01",
(ui32)PDisk->PDiskId, ev->Get()->ToString().c_str());
double burstMs;
auto* request = PDisk->ReqCreator.CreateFromEv<TLogRead>(*ev->Get(), ev->Sender, &burstMs);
auto* request = PDisk->ReqCreator.CreateFromEvPtr<TLogRead>(ev, &burstMs);
CheckBurst(request->IsSensitive, burstMs);
PDisk->InputRequest(request);
}
Expand Down Expand Up @@ -874,7 +874,7 @@ class TPDiskActor : public TActorBootstrapped<TPDiskActor> {
}

void Handle(NPDisk::TEvAskForCutLog::TPtr &ev) {
auto* request = PDisk->ReqCreator.CreateFromEv<TAskForCutLog>(*ev->Get(), ev->Sender);
auto* request = PDisk->ReqCreator.CreateFromEvPtr<TAskForCutLog>(ev);
PDisk->InputRequest(request);
}

Expand Down Expand Up @@ -1135,7 +1135,7 @@ class TPDiskActor : public TActorBootstrapped<TPDiskActor> {
}

void Handle(NPDisk::TEvReadLogContinue::TPtr &ev) {
auto *request = PDisk->ReqCreator.CreateFromEv<TLogReadContinue>(*ev->Get(), SelfId());
auto *request = PDisk->ReqCreator.CreateFromEvPtr<TLogReadContinue>(ev);
PDisk->InputRequest(request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ namespace NPDisk {
void TCompletionLogWrite::Exec(TActorSystem *actorSystem) {
// bool isNewChunksCommited = false;
if (CommitedLogChunks) {
auto* req = PDisk->ReqCreator.CreateFromArgs<TCommitLogChunks>(std::move(CommitedLogChunks));
NWilson::TSpan span(TWilson::PDisk, TraceId.Clone(), "PDisk.CommitLogChunks");
auto* req = PDisk->ReqCreator.CreateFromArgs<TCommitLogChunks>(std::move(CommitedLogChunks), std::move(span));
PDisk->InputRequest(req);
//isNewChunksCommited = true;
}
Expand Down Expand Up @@ -384,7 +385,9 @@ void TChunkTrimCompletion::Exec(TActorSystem *actorSystem) {
<< ui64(responseTimeMs) << " sizeBytes# " << SizeBytes);
LWPROBE(PDiskTrimResponseTime, PDisk->PDiskId, ReqId.Id, responseTimeMs, SizeBytes);
PDisk->Mon.Trim.CountResponse();
TTryTrimChunk *tryTrim = PDisk->ReqCreator.CreateFromArgs<TTryTrimChunk>(SizeBytes);
NWilson::TSpan span(TWilson::PDisk, std::move(TraceId), "PDisk.TryTrimChunk", NWilson::EFlags::AUTO_END, actorSystem);
span.Attribute("size", static_cast<i64>(SizeBytes));
TTryTrimChunk *tryTrim = PDisk->ReqCreator.CreateFromArgs<TTryTrimChunk>(SizeBytes, std::move(span));
PDisk->InputRequest(tryTrim);
delete this;
}
Expand Down
Loading