Skip to content

Commit

Permalink
Commit metrics by timer (#14179)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvru authored Feb 4, 2025
1 parent e367c3b commit 4595b4e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions ydb/core/mind/bscontroller/bsc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ STFUNC(TBlobStorageController::StateWork) {
hFunc(TEvBlobStorage::TEvGetBlockResult, ConsoleInteraction->Handle);
fFunc(TEvBlobStorage::EvControllerShredRequest, EnqueueIncomingEvent);
cFunc(TEvPrivate::EvUpdateShredState, ShredState.HandleUpdateShredState);
cFunc(TEvPrivate::EvCommitMetrics, CommitMetrics);
default:
if (!HandleDefaultEvents(ev, SelfId())) {
STLOG(PRI_ERROR, BS_CONTROLLER, BSC06, "StateWork unexpected event", (Type, type),
Expand Down
13 changes: 7 additions & 6 deletions ydb/core/mind/bscontroller/disk_metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ class TBlobStorageController::TTxUpdateDiskMetrics : public TTransactionBase<TBl
return true;
}

void Complete(const TActorContext&) override {}
void Complete(const TActorContext&) override {
TActivationContext::Schedule(TDuration::Seconds(15), new IEventHandle(TEvPrivate::EvCommitMetrics, 0,
Self->SelfId(), TActorId(), nullptr, 0));
}
};

void TBlobStorageController::Handle(TEvBlobStorage::TEvControllerUpdateDiskStatus::TPtr &ev) {
Expand Down Expand Up @@ -116,12 +119,10 @@ void TBlobStorageController::Handle(TEvBlobStorage::TEvControllerUpdateDiskStatu

// process VDisk status
ProcessVDiskStatus(record.GetVDiskStatus());
}

// commit into database if enough time has passed
if (now - LastMetricsCommit >= TDuration::Seconds(15)) {
Execute(new TTxUpdateDiskMetrics(this));
LastMetricsCommit = now;
}
void TBlobStorageController::CommitMetrics() {
Execute(new TTxUpdateDiskMetrics(this));
}

} // NKikimr::NBsController
5 changes: 4 additions & 1 deletion ydb/core/mind/bscontroller/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,6 @@ class TBlobStorageController : public TActor<TBlobStorageController>, public TTa
TMap<TGroupId, TBlobDepotDeleteQueueInfo> BlobDepotDeleteQueue;
ui64 NextOperationLogIndex = 1;
TActorId StatProcessorActorId;
TInstant LastMetricsCommit;
bool SelfHealEnable = false;
bool UseSelfHealLocalPolicy = false;
bool TryToRelocateBrokenDisksLocallyFirst = false;
Expand Down Expand Up @@ -1603,6 +1602,7 @@ class TBlobStorageController : public TActor<TBlobStorageController>, public TTa
EvProcessIncomingEvent,
EvUpdateHostRecords,
EvUpdateShredState,
EvCommitMetrics,
};

struct TEvUpdateSystemViews : public TEventLocal<TEvUpdateSystemViews, EvUpdateSystemViews> {};
Expand Down Expand Up @@ -1826,6 +1826,8 @@ class TBlobStorageController : public TActor<TBlobStorageController>, public TTa
void Handle(TEvInterconnect::TEvNodesInfo::TPtr &ev);
void OnHostRecordsInitiate();

void CommitMetrics();

public:
// Self-heal actor's main purpose is to monitor FAULTY pdisks and to slightly move groups out of them; every move
// should not render group unusable, also it should not exceed its fail model. It also takes into account replication
Expand Down Expand Up @@ -2177,6 +2179,7 @@ class TBlobStorageController : public TActor<TBlobStorageController>, public TTa
}

ShredState.Initialize();
CommitMetrics();
}

void UpdatePDisksCounters() {
Expand Down

0 comments on commit 4595b4e

Please sign in to comment.