Skip to content

Commit

Permalink
Check if CostTracker is initialized when used
Browse files Browse the repository at this point in the history
  • Loading branch information
serbel324 committed May 31, 2024
1 parent 9498edf commit b29c25d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
8 changes: 6 additions & 2 deletions ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompact.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ namespace NKikimr {
// the same logic for every yard response: apply response and restart main cycle
void HandleYardResponse(NPDisk::TEvChunkReadResult::TPtr& ev, const TActorContext &ctx) {
--PendingResponses;
HullCtx->VCtx->CostTracker->CountPDiskResponse();
if (HullCtx->VCtx->CostTracker) {
HullCtx->VCtx->CostTracker->CountPDiskResponse();
}
if (ev->Get()->Status != NKikimrProto::CORRUPTED) {
CHECK_PDISK_RESPONSE(HullCtx->VCtx, ev, ctx);
}
Expand Down Expand Up @@ -200,7 +202,9 @@ namespace NKikimr {

void HandleYardResponse(NPDisk::TEvChunkWriteResult::TPtr& ev, const TActorContext &ctx) {
--PendingResponses;
HullCtx->VCtx->CostTracker->CountPDiskResponse();
if (HullCtx->VCtx->CostTracker) {
HullCtx->VCtx->CostTracker->CountPDiskResponse();
}
CHECK_PDISK_RESPONSE(HullCtx->VCtx, ev, ctx);
if (FinalizeIfAborting(ctx)) {
return;
Expand Down
8 changes: 6 additions & 2 deletions ydb/core/blobstorage/vdisk/scrub/scrub_actor_pdisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ namespace NKikimr {
Send(ScrubCtx->PDiskCtx->PDiskId, msg.release());
CurrentState = TStringBuilder() << "reading data from " << part.ToString();
auto res = WaitForPDiskEvent<NPDisk::TEvChunkReadResult>();
ScrubCtx->VCtx->CostTracker->CountPDiskResponse();
if (ScrubCtx->VCtx->CostTracker) {
ScrubCtx->VCtx->CostTracker->CountPDiskResponse();
}
auto *m = res->Get();
Y_VERIFY_S(m->Status == NKikimrProto::OK || m->Status == NKikimrProto::CORRUPTED,
"Status# " << NKikimrProto::EReplyStatus_Name(m->Status));
Expand Down Expand Up @@ -42,7 +44,9 @@ namespace NKikimr {
Send(ScrubCtx->PDiskCtx->PDiskId, msg.release());
CurrentState = TStringBuilder() << "writing index to " << part.ToString();
auto res = WaitForPDiskEvent<NPDisk::TEvChunkWriteResult>();
ScrubCtx->VCtx->CostTracker->CountPDiskResponse();
if (ScrubCtx->VCtx->CostTracker) {
ScrubCtx->VCtx->CostTracker->CountPDiskResponse();
}
Y_ABORT_UNLESS(res->Get()->Status == NKikimrProto::OK); // FIXME: good logic
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1259,10 +1259,14 @@ namespace NKikimr {
} else {
if (clientId.GetType() == NBackpressure::EQueueClientType::DSProxy) {
CostGroup.SkeletonFrontUserCostNs() += cost;
VCtx->CostTracker->CountUserCost(advancedCost);
if (VCtx->CostTracker) {
VCtx->CostTracker->CountUserCost(advancedCost);
}
} else {
CostGroup.SkeletonFrontInternalCostNs() += cost;
VCtx->CostTracker->CountInternalCost(advancedCost);
if (VCtx->CostTracker) {
VCtx->CostTracker->CountInternalCost(advancedCost);
}
}
}
}
Expand Down Expand Up @@ -1609,7 +1613,9 @@ namespace NKikimr {
extQueue.Completed(ctx, msgCtx, event);
TIntQueueClass &intQueue = GetIntQueue(msgCtx.IntQueueId);
intQueue.Completed(ctx, msgCtx, *this);
VCtx->CostTracker->CountPDiskResponse();
if (VCtx->CostTracker) {
VCtx->CostTracker->CountPDiskResponse();
}
if (!ev->Get()->DoNotResend) {
TActivationContext::Send(event.release());
}
Expand Down
4 changes: 3 additions & 1 deletion ydb/core/blobstorage/vdisk/skeleton/skeleton_oos_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ namespace NKikimr {
if (msg->NumSlots > 0) {
ui32 timeAvailable = 1'000'000'000 / msg->NumSlots;
CostGroup.DiskTimeAvailableNs() = timeAvailable;
VCtx->CostTracker->SetTimeAvailable(timeAvailable);
if (VCtx->CostTracker) {
VCtx->CostTracker->SetTimeAvailable(timeAvailable);
}
}

Become(&TThis::WaitFunc);
Expand Down

0 comments on commit b29c25d

Please sign in to comment.