Skip to content

Commit 757d6aa

Browse files
authored
Added macro to enable/disable VDiskSkeletonTrace (#1967)
1 parent 4a216b8 commit 757d6aa

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

ydb/core/blobstorage/vdisk/common/vdisk_events.h

+12
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
#define BS_EVVGET_SIZE_VERIFY 0
3636
#endif
3737

38+
#ifndef VDISK_SKELETON_TRACE
39+
#define VDISK_SKELETON_TRACE 0
40+
#endif
41+
3842
namespace NKikimr {
3943

4044
namespace NBackpressure {
@@ -1528,7 +1532,9 @@ namespace NKikimr {
15281532
, TEventWithRelevanceTracker
15291533
{
15301534
mutable NLWTrace::TOrbit Orbit;
1535+
#if VDISK_SKELETON_TRACE
15311536
std::shared_ptr<TVDiskSkeletonTrace> VDiskSkeletonTrace;
1537+
#endif
15321538

15331539
TEvVSpecialPatchBase() = default;
15341540

@@ -1922,7 +1928,9 @@ namespace NKikimr {
19221928
, TEventWithRelevanceTracker
19231929
{
19241930
mutable NLWTrace::TOrbit Orbit;
1931+
#if VDISK_SKELETON_TRACE
19251932
std::shared_ptr<TVDiskSkeletonTrace> VDiskSkeletonTrace;
1933+
#endif
19261934

19271935
TEvVPatchStart() = default;
19281936

@@ -2008,7 +2016,9 @@ namespace NKikimr {
20082016
, TEventWithRelevanceTracker
20092017
{
20102018
mutable NLWTrace::TOrbit Orbit;
2019+
#if VDISK_SKELETON_TRACE
20112020
std::shared_ptr<TVDiskSkeletonTrace> VDiskSkeletonTrace;
2021+
#endif
20122022

20132023
TEvVPatchDiff() = default;
20142024

@@ -2083,7 +2093,9 @@ namespace NKikimr {
20832093
, TEventWithRelevanceTracker
20842094
{
20852095
mutable NLWTrace::TOrbit Orbit;
2096+
#if VDISK_SKELETON_TRACE
20862097
std::shared_ptr<TVDiskSkeletonTrace> VDiskSkeletonTrace;
2098+
#endif
20872099

20882100
TEvVPatchXorDiff() = default;
20892101

ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,11 @@ namespace NKikimr {
335335
hasError = true;
336336
STLOG(PRI_ERROR, NKikimrServices::BS_SKELETON, BSVSF04,
337337
vDiskLogPrefix << " passed more than 5 munites for message in the internal queue",
338-
(MsgId, msgInfo.MsgId),,
338+
(MsgId, msgInfo.MsgId),
339339
(QueueName, Name),
340340
(PassedTimeSeconds, passedTime.Seconds()),
341-
(Trace, (msgInfo.VDiskSkeletonTrace ? msgInfo.VDiskSkeletonTrace->ToString() : "None")));
341+
(Trace, (msgInfo.VDiskSkeletonTrace ? msgInfo.VDiskSkeletonTrace->ToString() : "None"))
342+
);
342343
}
343344
}
344345
return hasError;
@@ -1230,9 +1231,11 @@ namespace NKikimr {
12301231
ev->Forward(SkeletonId).Release()), msgId, cost, *this, clientId);
12311232
if (event) {
12321233
std::shared_ptr<TVDiskSkeletonTrace> trace;
1234+
#if VDISK_SKELETON_TRACE
12331235
if constexpr (IsPatchEvent<TEvent>) {
1234-
event->Get<TEvent>()->VDiskSkeletonTrace = std::make_shared<TVDiskSkeletonTrace>();
1236+
event->Get<TEvent>()->VDiskSkeletonTrace = trace = std::make_shared<TVDiskSkeletonTrace>();
12351237
}
1238+
#endif
12361239
// good, enqueue it in intQueue
12371240
intQueue.Enqueue(ctx, recByteSize, std::move(event), msgId, cost, deadline, extQueueId, *this, clientId,
12381241
std::move(trace), internalMessageId);

ydb/core/blobstorage/vdisk/skeleton/skeleton_vpatch_actor.cpp

+25-1
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,19 @@ namespace NKikimr::NPrivate {
115115
ui64 ReceivedXorDiffCount = 0;
116116
ui64 WaitedXorDiffCount = 0;
117117

118+
#if VDISK_SKELETON_TRACE
118119
std::shared_ptr<TVDiskSkeletonTrace> PatchActorTrace;
119120
std::shared_ptr<TVDiskSkeletonTrace> CurrentEventTrace;
120121

121-
122122
void AddMark(const char * const mark) {
123123
PatchActorTrace->AddMark(mark);
124124
if (CurrentEventTrace) {
125125
CurrentEventTrace->AddMark(mark);
126126
}
127127
}
128+
#else
129+
void AddMark(const char* /*mark*/) {}
130+
#endif
128131

129132
public:
130133
TSkeletonVPatchActor(TActorId leaderId, const TBlobStorageGroupType &gType,
@@ -146,8 +149,10 @@ namespace NKikimr::NPrivate {
146149
, LeaderId(leaderId)
147150
, IncarnationGuid(incarnationGuid)
148151
, GType(gType)
152+
#if VDISK_SKELETON_TRACE
149153
, PatchActorTrace(std::make_shared<TVDiskSkeletonTrace>())
150154
, CurrentEventTrace(std::move(ev->Get()->VDiskSkeletonTrace))
155+
#endif
151156
{
152157
NKikimrBlobStorage::TEvVPatchStart &record = ev->Get()->Record;
153158
if (record.HasMsgQoS() && record.GetMsgQoS().HasDeadlineSeconds()) {
@@ -167,9 +172,11 @@ namespace NKikimr::NPrivate {
167172
FoundPartsEvent = std::make_unique<TEvBlobStorage::TEvVPatchFoundParts>(
168173
NKikimrProto::OK, OriginalBlobId, PatchedBlobId, VDiskId, record.GetCookie(), now, ErrorReason, &record,
169174
SkeletonFrontIDPtr, VPatchFoundPartsMsgsPtr, getHistogram, IncarnationGuid);
175+
#if VDISK_SKELETON_TRACE
170176
if (CurrentEventTrace) {
171177
CurrentEventTrace->AdditionalTrace = PatchActorTrace;
172178
}
179+
#endif
173180
AddMark("TSkeletonVPatchActor created");
174181
}
175182

@@ -219,11 +226,13 @@ namespace NKikimr::NPrivate {
219226
FoundPartsEvent->AddPart(part);
220227
}
221228
FoundPartsEvent->SetStatus(status);
229+
#if VDISK_SKELETON_TRACE
222230
if (CurrentEventTrace) {
223231
CurrentEventTrace->AdditionalTrace = nullptr;
224232
}
225233
AddMark((FoundOriginalParts.size() ? "Found parts" : "Parts were not found"));
226234
CurrentEventTrace = nullptr;
235+
#endif
227236
SendVDiskResponse(TActivationContext::AsActorContext(), Sender, FoundPartsEvent.release(), Cookie);
228237
}
229238

@@ -303,11 +312,13 @@ namespace NKikimr::NPrivate {
303312
(ErrorReason, ErrorReason));
304313
Y_ABORT_UNLESS(ResultEvent);
305314
ResultEvent->SetStatus(status, ErrorReason);
315+
#if VDISK_SKELETON_TRACE
306316
if (CurrentEventTrace) {
307317
CurrentEventTrace->AdditionalTrace = nullptr;
308318
}
309319
AddMark((status == NKikimrProto::OK ? "Patch ends with OK" : "Patch ends witn NOT OK"));
310320
CurrentEventTrace = nullptr;
321+
#endif
311322
if (forceEnd) {
312323
ResultEvent->SetForceEndResponse();
313324
}
@@ -502,7 +513,9 @@ namespace NKikimr::NPrivate {
502513
&record, SkeletonFrontIDPtr, VPatchResMsgsPtr, PutHistogram, IncarnationGuid);
503514
Sender = ev->Sender;
504515
Cookie = ev->Cookie;
516+
#if VDISK_SKELETON_TRACE
505517
CurrentEventTrace = std::move(ev->Get()->VDiskSkeletonTrace);
518+
#endif
506519
AddMark("Error: HandleError TEvVPatchDiff");
507520
SendVPatchResult(NKikimrProto::ERROR, ev->Get()->IsForceEnd());
508521
}
@@ -523,10 +536,12 @@ namespace NKikimr::NPrivate {
523536

524537
void Handle(TEvBlobStorage::TEvVPatchDiff::TPtr &ev) {
525538
NKikimrBlobStorage::TEvVPatchDiff &record = ev->Get()->Record;
539+
#if VDISK_SKELETON_TRACE
526540
CurrentEventTrace = std::move(ev->Get()->VDiskSkeletonTrace);
527541
if (CurrentEventTrace) {
528542
CurrentEventTrace->AdditionalTrace = PatchActorTrace;
529543
}
544+
#endif
530545
Y_ABORT_UNLESS(record.HasCookie());
531546
AddMark("Receive TEvVPatchDiff");
532547

@@ -630,9 +645,11 @@ namespace NKikimr::NPrivate {
630645
auto resultEvent = std::make_unique<TEvBlobStorage::TEvVPatchXorDiffResult>(
631646
NKikimrProto::ERROR, now, &record, SkeletonFrontIDPtr, VPatchResMsgsPtr, PutHistogram);
632647
AddMark("Error: HandleError TEvVPatchXorDiff");
648+
#if VDISK_SKELETON_TRACE
633649
if (ev->Get()->VDiskSkeletonTrace) {
634650
ev->Get()->VDiskSkeletonTrace->AddMark("Error: HandleError TEvVPatchXorDiff");
635651
}
652+
#endif
636653
SendVDiskResponse(TActivationContext::AsActorContext(), ev->Sender, resultEvent.release(), ev->Cookie);
637654
}
638655

@@ -652,18 +669,25 @@ namespace NKikimr::NPrivate {
652669
(ToPart, (ui32)toPart),
653670
(HasBuffer, (Buffer.GetSize() == 0 ? "no" : "yes")),
654671
(ReceivedXorDiffCount, TStringBuilder() << ReceivedXorDiffCount << '/' << WaitedXorDiffCount));
672+
655673
AddMark("received xor diff");
674+
#if VDISK_SKELETON_TRACE
656675
if (ev->Get()->VDiskSkeletonTrace) {
657676
ev->Get()->VDiskSkeletonTrace->AddMark("received xor diff");
658677
}
678+
#endif
659679

660680
TInstant now = TActivationContext::Now();
661681
std::unique_ptr<TEvBlobStorage::TEvVPatchXorDiffResult> resultEvent = std::make_unique<TEvBlobStorage::TEvVPatchXorDiffResult>(
662682
NKikimrProto::OK, now, &record, SkeletonFrontIDPtr, VPatchResMsgsPtr, PutHistogram);
683+
663684
AddMark("Send xor diff result");
685+
#if VDISK_SKELETON_TRACE
664686
if (ev->Get()->VDiskSkeletonTrace) {
665687
ev->Get()->VDiskSkeletonTrace->AddMark("Send xor diff result");
666688
}
689+
#endif
690+
667691
SendVDiskResponse(TActivationContext::AsActorContext(), ev->Sender, resultEvent.release(), ev->Cookie);
668692

669693
if (!CheckDiff(xorDiffs, "XorDiff from datapart")) {

0 commit comments

Comments
 (0)