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

KIKIMR-20042 Enchanced VDisk tracing #571

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ LWTRACE_USING(BLOBSTORAGE_PROVIDER);
HugeKeeperCtx->PDiskCtx->Dsk->OwnerRound, chunkId, offset,
partsPtr, Cookie, true, GetWritePriority(), false);
ev->Orbit = std::move(Item->Orbit);
ctx.Send(HugeKeeperCtx->PDiskCtx->PDiskId, ev.release());
ctx.Send(HugeKeeperCtx->PDiskCtx->PDiskId, ev.release(), 0, 0, Span.GetTraceId());
DiskAddr = TDiskPart(chunkId, offset, storedBlobSize);

// wait response
Expand Down Expand Up @@ -229,7 +229,10 @@ LWTRACE_USING(BLOBSTORAGE_PROVIDER);
CFunc(TEvents::TSystem::Poison, Die)
)

void HandlePoison(TEvents::TEvPoison::TPtr&, const TActorContext& ctx) { Die(ctx); }
void HandlePoison(TEvents::TEvPoison::TPtr&, const TActorContext& ctx) {
Span.EndError("EvPoison");
Die(ctx);
}
PDISK_TERMINATE_STATE_FUNC_DEF;

public:
Expand Down
17 changes: 13 additions & 4 deletions ydb/core/blobstorage/vdisk/query/query_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "query_spacetracker.h"
#include <ydb/core/blobstorage/vdisk/hulldb/hull_ds_all_snap.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_response.h>
#include <ydb/library/wilson_ids/wilson.h>

namespace NKikimr {

Expand All @@ -24,14 +25,17 @@ namespace NKikimr {
TQueryResultSizeTracker ResultSize;
const TActorId ReplSchedulerId;

NWilson::TSpan Span;

TLevelIndexQueryBase(
std::shared_ptr<TQueryCtx> &queryCtx,
const TActorId &parentId,
TLogoBlobsSnapshot &&logoBlobsSnapshot,
TBarriersSnapshot &&barrierSnapshot,
TEvBlobStorage::TEvVGet::TPtr &ev,
std::unique_ptr<TEvBlobStorage::TEvVGetResult> result,
TActorId replSchedulerId)
TActorId replSchedulerId,
TString name)
domwst marked this conversation as resolved.
Show resolved Hide resolved
: QueryCtx(queryCtx)
, ParentId(parentId)
, LogoBlobsSnapshot(std::move(logoBlobsSnapshot))
Expand All @@ -41,6 +45,7 @@ namespace NKikimr {
, ShowInternals(Record.GetShowInternals())
, Result(std::move(result))
, ReplSchedulerId(replSchedulerId)
, Span(TWilson::VDiskTopLevel, std::move(BatcherCtx->OrigEv->TraceId), std::move(name))
{
Y_DEBUG_ABORT_UNLESS(Result);
}
Expand Down Expand Up @@ -87,11 +92,13 @@ namespace NKikimr {
Result->AddResult(NKikimrProto::ERROR, id, &cookie);
}
}
LOG_CRIT(ctx, NKikimrServices::BS_VDISK_GET,
VDISKP(QueryCtx->HullCtx->VCtx->VDiskLogPrefix,
auto msg = VDISKP(QueryCtx->HullCtx->VCtx->VDiskLogPrefix,
"TEvVGetResult: Result message is too large; size# %" PRIu64 " orig# %s;"
" VDISK CAN NOT REPLY ON TEvVGet REQUEST",
ResultSize.GetSize(), BatcherCtx->OrigEv->Get()->ToString().data()));
ResultSize.GetSize(), BatcherCtx->OrigEv->Get()->ToString().data());
LOG_CRIT(ctx, NKikimrServices::BS_VDISK_GET, msg);

Span.EndError(std::move(msg));
} else {
ui64 total = 0;
for (const auto& result : Result->Record.GetResult()) {
Expand All @@ -102,6 +109,8 @@ namespace NKikimr {
LOG_DEBUG(ctx, NKikimrServices::BS_VDISK_GET,
VDISKP(QueryCtx->HullCtx->VCtx->VDiskLogPrefix,
"TEvVGetResult: %s", Result->ToString().data()));

Span.EndOk();
}

if (hasNotYet && ReplSchedulerId) {
Expand Down
15 changes: 9 additions & 6 deletions ydb/core/blobstorage/vdisk/query/query_extr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ namespace NKikimr {
TBarriersSnapshot &&barrierSnapshot,
TEvBlobStorage::TEvVGet::TPtr &ev,
std::unique_ptr<TEvBlobStorage::TEvVGetResult> result,
TActorId replSchedulerId)
TActorId replSchedulerId,
TString name)
: TLevelIndexQueryBase(queryCtx, parentId, std::move(logoBlobsSnapshot), std::move(barrierSnapshot),
ev, std::move(result), replSchedulerId)
ev, std::move(result), replSchedulerId, std::move(name))
{}
};

Expand Down Expand Up @@ -161,7 +162,8 @@ namespace NKikimr {
std::unique_ptr<TEvBlobStorage::TEvVGetResult> result,
TActorId replSchedulerId)
: TLevelIndexExtremeQueryViaBatcherBase(queryCtx, parentId, std::move(logoBlobsSnapshot),
std::move(barrierSnapshot), ev, std::move(result), replSchedulerId)
std::move(barrierSnapshot), ev, std::move(result), replSchedulerId,
"VDisk.LevelIndexExtremeQueryViaBatcherIndexOnly")
, TActorBootstrapped<TLevelIndexExtremeQueryViaBatcherIndexOnly>()
, Merger(QueryCtx->HullCtx->VCtx->Top->GType)
{}
Expand Down Expand Up @@ -367,8 +369,7 @@ namespace NKikimr {
SendResponseAndDie(ctx, this);
} else {
ui8 priority = PDiskPriority();
std::unique_ptr<IActor> a(Batcher.CreateAsyncDataReader(ctx.SelfID, priority, /*std::move(Result->TraceId)*/ NWilson::TTraceId(), // FIXME: trace
IsRepl()));
std::unique_ptr<IActor> a(Batcher.CreateAsyncDataReader(ctx.SelfID, priority, Span.GetTraceId(), IsRepl()));
if (a) {
auto aid = ctx.Register(a.release());
ActiveActors.Insert(aid, __FILE__, __LINE__, ctx, NKikimrServices::BLOBSTORAGE);
Expand All @@ -385,6 +386,7 @@ namespace NKikimr {
void HandlePoison(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
Y_UNUSED(ev);
ActiveActors.KillAndClear(ctx);
Span.EndError("TEvPoisonPill");
Die(ctx);
}

Expand All @@ -409,7 +411,8 @@ namespace NKikimr {
std::unique_ptr<TEvBlobStorage::TEvVGetResult> result,
TActorId replSchedulerId)
: TLevelIndexExtremeQueryViaBatcherBase(queryCtx, parentId, std::move(logoBlobsSnapshot),
std::move(barrierSnapshot), ev, std::move(result), replSchedulerId)
std::move(barrierSnapshot), ev, std::move(result), replSchedulerId,
"VDisk.LevelIndexExtremeQueryViaBatcherMergeData")
, TActorBootstrapped<TLevelIndexExtremeQueryViaBatcherMergeData>()
, GType(QueryCtx->HullCtx->VCtx->Top->GType)
, Batcher(BatcherCtx)
Expand Down
8 changes: 5 additions & 3 deletions ydb/core/blobstorage/vdisk/query/query_range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ namespace NKikimr {
TBarriersSnapshot &&barriersSnapshot,
TEvBlobStorage::TEvVGet::TPtr &ev,
std::unique_ptr<TEvBlobStorage::TEvVGetResult> result,
TActorId replSchedulerId)
TActorId replSchedulerId,
TString name)
: TLevelIndexQueryBase(queryCtx, parentId, std::move(logoBlobsSnapshot), std::move(barriersSnapshot),
ev, std::move(result), replSchedulerId)
ev, std::move(result), replSchedulerId, std::move(name))
, ForwardIt(QueryCtx->HullCtx, &LogoBlobsSnapshot)
, BackwardIt(QueryCtx->HullCtx, &LogoBlobsSnapshot)
, First()
Expand Down Expand Up @@ -155,7 +156,8 @@ namespace NKikimr {
std::unique_ptr<TEvBlobStorage::TEvVGetResult> result,
TActorId replSchedulerId)
: TLevelIndexRangeQueryViaBatcherBase(queryCtx, parentId,
std::move(logoBlobsSnapshot), std::move(barriersSnapshot), ev, std::move(result), replSchedulerId)
std::move(logoBlobsSnapshot), std::move(barriersSnapshot), ev, std::move(result), replSchedulerId,
"VDisk.LevelIndexRangeQueryViaBatcherBase")
, TActorBootstrapped<TLevelIndexRangeQueryViaBatcherIndexOnly>()
, Merger(QueryCtx->HullCtx->VCtx->Top->GType)
{
Expand Down
2 changes: 2 additions & 0 deletions ydb/core/blobstorage/vdisk/query/query_readactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ namespace NKikimr {
" origReadN# %" PRIu32, this, ui32(Result->GlueReads.size()),
ui32(Result->DiskDataItemPtrs.size())));
ctx.Send(NotifyID, new TEvents::TEvCompleted);
Span.EndOk();
Die(ctx);
}

Expand Down Expand Up @@ -96,6 +97,7 @@ namespace NKikimr {

void HandlePoison(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
Y_UNUSED(ev);
Span.EndError("EvPoisonPill");
TThis::Die(ctx);
}

Expand Down
1 change: 1 addition & 0 deletions ydb/core/blobstorage/vdisk/query/query_readactor.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include "defs.h"
#include <ydb/core/blobstorage/vdisk/query/query_readbatch.h>

namespace NKikimr {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ namespace NKikimr {
if (!info.IsHugeBlob) {
auto logMsg = CreatePutLogEvent(ctx, "TEvVPut", ev->Sender, ev->Cookie,
std::move(ev->Get()->Orbit), info, std::move(result));
ctx.Send(Db->LoggerID, logMsg.release());
ctx.Send(Db->LoggerID, logMsg.release(), 0, 0, std::move(info.TraceId));
} else if (info.Buffer) {
// pass the work to huge blob writer
NKikimrBlobStorage::EPutHandleClass handleClass = record.GetHandleClass();
Expand Down
Loading