aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Rutkovsky <alexvru@ydb.tech>2024-05-06 19:27:24 +0300
committerGitHub <noreply@github.com>2024-05-06 18:27:24 +0200
commit77a85af1f63aa554a51fca4e7dc2e61f91a34ce8 (patch)
tree71ef92dd19774a21c3001bcdd91bab359ad1f8bf
parent068e8291de67631f063304b76dda3c1fd6601c12 (diff)
downloadydb-77a85af1f63aa554a51fca4e7dc2e61f91a34ce8.tar.gz
General SelfHeal fixes (#4315)
-rw-r--r--ydb/core/mind/bscontroller/config_cmd.cpp3
-rw-r--r--ydb/core/mind/bscontroller/impl.h15
-rw-r--r--ydb/core/mind/bscontroller/register_node.cpp18
-rw-r--r--ydb/core/mind/bscontroller/self_heal.cpp127
-rw-r--r--ydb/core/mind/bscontroller/self_heal.h18
-rw-r--r--ydb/core/mind/bscontroller/ut_bscontroller/main.cpp25
-rw-r--r--ydb/core/mind/bscontroller/ut_selfheal/self_heal_actor_ut.cpp7
-rw-r--r--ydb/core/mind/bscontroller/vdisk_status_tracker.h29
-rw-r--r--ydb/core/mind/bscontroller/ya.make1
9 files changed, 98 insertions, 145 deletions
diff --git a/ydb/core/mind/bscontroller/config_cmd.cpp b/ydb/core/mind/bscontroller/config_cmd.cpp
index 0b555eee04..3fa28bdcf2 100644
--- a/ydb/core/mind/bscontroller/config_cmd.cpp
+++ b/ydb/core/mind/bscontroller/config_cmd.cpp
@@ -99,6 +99,9 @@ namespace NKikimr::NBsController {
for (bool value : settings.GetEnableDonorMode()) {
Self->DonorMode = value;
db.Table<T>().Key(true).Update<T::DonorModeEnable>(Self->DonorMode);
+ auto ev = std::make_unique<TEvControllerUpdateSelfHealInfo>();
+ ev->DonorMode = Self->DonorMode;
+ Self->Send(Self->SelfHealId, ev.release());
}
for (ui64 value : settings.GetScrubPeriodicitySeconds()) {
Self->ScrubPeriodicity = TDuration::Seconds(value);
diff --git a/ydb/core/mind/bscontroller/impl.h b/ydb/core/mind/bscontroller/impl.h
index bfd2c59ae0..72120e08b4 100644
--- a/ydb/core/mind/bscontroller/impl.h
+++ b/ydb/core/mind/bscontroller/impl.h
@@ -471,8 +471,8 @@ public:
|| Status == NKikimrBlobStorage::EDriveStatus::INACTIVE;
}
- std::tuple<bool, bool> GetSelfHealStatusTuple() const {
- return {ShouldBeSettledBySelfHeal(), BadInTermsOfSelfHeal()};
+ auto GetSelfHealStatusTuple() const {
+ return std::make_tuple(ShouldBeSettledBySelfHeal(), BadInTermsOfSelfHeal(), Decommitted(), IsSelfHealReasonDecommit());
}
bool AcceptsNewSlots() const {
@@ -2222,12 +2222,15 @@ public:
const TMonotonic now = TActivationContext::Monotonic();
THashSet<TGroupInfo*> groups;
- auto sh = std::make_unique<TEvControllerUpdateSelfHealInfo>();
+ std::vector<TEvControllerUpdateSelfHealInfo::TVDiskStatusUpdate> updates;
for (auto it = VSlotReadyTimestampQ.begin(); it != VSlotReadyTimestampQ.end() && it->first <= now;
it = VSlotReadyTimestampQ.erase(it)) {
Y_DEBUG_ABORT_UNLESS(!it->second->IsReady);
- sh->VDiskIsReadyUpdate.emplace_back(it->second->GetVDiskId(), true);
+ updates.push_back({
+ .VDiskId = it->second->GetVDiskId(),
+ .IsReady = true,
+ });
it->second->IsReady = true;
it->second->ResetVSlotReadyTimestampIter();
if (const TGroupInfo *group = it->second->Group) {
@@ -2245,8 +2248,8 @@ public:
if (!timingQ.empty()) {
Execute(CreateTxUpdateLastSeenReady(std::move(timingQ)));
}
- if (sh->VDiskIsReadyUpdate) {
- Send(SelfHealId, sh.release());
+ if (!updates.empty()) {
+ Send(SelfHealId, new TEvControllerUpdateSelfHealInfo(std::move(updates)));
}
}
diff --git a/ydb/core/mind/bscontroller/register_node.cpp b/ydb/core/mind/bscontroller/register_node.cpp
index 93ab1fbc71..a8307685a4 100644
--- a/ydb/core/mind/bscontroller/register_node.cpp
+++ b/ydb/core/mind/bscontroller/register_node.cpp
@@ -549,25 +549,29 @@ void TBlobStorageController::OnWardenDisconnected(TNodeId nodeId, TActorId serve
SysViewChangedPDisks.insert(it->first);
}
const TVSlotId startingId(nodeId, Min<Schema::VSlot::PDiskID::Type>(), Min<Schema::VSlot::VSlotID::Type>());
- auto sh = MakeHolder<TEvControllerUpdateSelfHealInfo>();
+ std::vector<TEvControllerUpdateSelfHealInfo::TVDiskStatusUpdate> updates;
for (auto it = VSlots.lower_bound(startingId); it != VSlots.end() && it->first.NodeId == nodeId; ++it) {
if (const TGroupInfo *group = it->second->Group) {
if (it->second->IsReady) {
NotReadyVSlotIds.insert(it->second->VSlotId);
- sh->VDiskIsReadyUpdate.emplace_back(it->second->GetVDiskId(), false);
}
it->second->SetStatus(NKikimrBlobStorage::EVDiskStatus::ERROR, mono, now, false);
timingQ.emplace_back(*it->second);
- sh->VDiskStatusUpdate.emplace_back(it->second->GetVDiskId(), it->second->Status, false);
+ updates.push_back({
+ .VDiskId = it->second->GetVDiskId(),
+ .IsReady = it->second->IsReady,
+ .VDiskStatus = it->second->Status,
+ });
ScrubState.UpdateVDiskState(&*it->second);
}
}
for (auto it = StaticVSlots.lower_bound(startingId); it != StaticVSlots.end() && it->first.NodeId == nodeId; ++it) {
- it->second.VDiskStatus = NKikimrBlobStorage::EVDiskStatus::ERROR;
- it->second.ReadySince = TMonotonic::Max();
+ auto& slot = it->second;
+ slot.ReadySince = TMonotonic::Max();
+ slot.VDiskStatus = NKikimrBlobStorage::EVDiskStatus::ERROR;
}
- if (sh->VDiskStatusUpdate) {
- Send(SelfHealId, sh.Release());
+ if (!updates.empty()) {
+ Send(SelfHealId, new TEvControllerUpdateSelfHealInfo(std::move(updates)));
}
ScrubState.OnNodeDisconnected(nodeId);
EraseKnownDrivesOnDisconnected(&node);
diff --git a/ydb/core/mind/bscontroller/self_heal.cpp b/ydb/core/mind/bscontroller/self_heal.cpp
index 95e7accfdc..67c84c9aef 100644
--- a/ydb/core/mind/bscontroller/self_heal.cpp
+++ b/ydb/core/mind/bscontroller/self_heal.cpp
@@ -1,6 +1,5 @@
#include "self_heal.h"
#include "impl.h"
-#include "vdisk_status_tracker.h"
#include "config.h"
#include "group_geometry_info.h"
#include "group_layout_checker.h"
@@ -50,7 +49,7 @@ namespace NKikimr::NBsController {
public:
TReassignerActor(TActorId controllerId, TGroupId groupId, TEvControllerUpdateSelfHealInfo::TGroupContent group,
std::optional<TVDiskID> vdiskToReplace, std::shared_ptr<TBlobStorageGroupInfo::TTopology> topology,
- bool isSelfHealReasonDecommit)
+ bool isSelfHealReasonDecommit, bool /*donorMode*/)
: ControllerId(controllerId)
, GroupId(groupId)
, Group(std::move(group))
@@ -236,8 +235,7 @@ namespace NKikimr::NBsController {
TEvControllerUpdateSelfHealInfo::TGroupContent Content;
TActorId ReassignerActorId; // reassigner in flight
TDuration RetryTimeout = MinRetryTimeout;
- TInstant NextRetryTimestamp = TInstant::Zero();
- THashMap<TVDiskID, TVDiskStatusTracker> VDiskStatus;
+ TMonotonic NextRetryTimestamp = TMonotonic::Zero();
std::shared_ptr<TBlobStorageGroupInfo::TTopology> Topology;
bool LayoutValid = true;
@@ -255,8 +253,9 @@ namespace NKikimr::NBsController {
TIntrusiveList<TGroupRecord, TWithFaultyDisks> GroupsWithFaultyDisks;
TIntrusiveList<TGroupRecord, TWithInvalidLayout> GroupsWithInvalidLayout;
std::shared_ptr<std::atomic_uint64_t> UnreassignableGroups;
- bool GroupLayoutSanitizerEnabled = false;
- bool AllowMultipleRealmsOccupation = true;
+ bool GroupLayoutSanitizerEnabled;
+ bool AllowMultipleRealmsOccupation;
+ bool DonorMode;
THostRecordMap HostRecords;
using TTopologyDescr = std::tuple<TBlobStorageGroupType::EErasureSpecies, ui32, ui32, ui32>;
@@ -268,9 +267,13 @@ namespace NKikimr::NBsController {
TOperationLog<GroupLayoutSanitizerOperationLogSize> GroupLayoutSanitizerOperationLog;
public:
- TSelfHealActor(ui64 tabletId, std::shared_ptr<std::atomic_uint64_t> unreassignableGroups, THostRecordMap hostRecords)
+ TSelfHealActor(ui64 tabletId, std::shared_ptr<std::atomic_uint64_t> unreassignableGroups, THostRecordMap hostRecords,
+ bool groupLayoutSanitizerEnabled, bool allowMultipleRealmsOccupation, bool donorMode)
: TabletId(tabletId)
, UnreassignableGroups(std::move(unreassignableGroups))
+ , GroupLayoutSanitizerEnabled(groupLayoutSanitizerEnabled)
+ , AllowMultipleRealmsOccupation(allowMultipleRealmsOccupation)
+ , DonorMode(donorMode)
, HostRecords(std::move(hostRecords))
{}
@@ -280,8 +283,11 @@ namespace NKikimr::NBsController {
HandleWakeup();
}
+ static bool IsReady(const TEvControllerUpdateSelfHealInfo::TGroupContent::TVDiskInfo& vdisk, TMonotonic now) {
+ return vdisk.IsReady && now >= vdisk.ReadySince;
+ }
+
void Handle(TEvControllerUpdateSelfHealInfo::TPtr& ev) {
- const TInstant now = TActivationContext::Now();
if (const auto& setting = ev->Get()->GroupLayoutSanitizerEnabled) {
bool previousSetting = std::exchange(GroupLayoutSanitizerEnabled, *setting);
if (!previousSetting && GroupLayoutSanitizerEnabled) {
@@ -294,6 +300,9 @@ namespace NKikimr::NBsController {
UpdateLayoutInformationForAllGroups();
}
}
+ if (const auto& setting = ev->Get()->DonorMode) {
+ DonorMode = *setting;
+ }
bool groupsDeleted = false;
for (const auto& [groupId, data] : ev->Get()->GroupsToUpdate) {
if (data) {
@@ -316,19 +325,11 @@ namespace NKikimr::NBsController {
ui32 numVDisksPerFailDomain = 0;
for (const auto& [vdiskId, vdisk] : g.Content.VDisks) {
- g.VDiskStatus[vdiskId].Update(vdisk.VDiskStatus, now);
hasFaultyDisks |= vdisk.Faulty;
numFailRealms = Max<ui32>(numFailRealms, 1 + vdiskId.FailRealm);
numFailDomainsPerFailRealm = Max<ui32>(numFailDomainsPerFailRealm, 1 + vdiskId.FailDomain);
numVDisksPerFailDomain = Max<ui32>(numVDisksPerFailDomain, 1 + vdiskId.VDisk);
}
- for (auto it = g.VDiskStatus.begin(); it != g.VDiskStatus.end(); ) {
- if (g.Content.VDisks.count(it->first)) {
- ++it;
- } else {
- g.VDiskStatus.erase(it++);
- }
- }
if (hasFaultyDisks) {
GroupsWithFaultyDisks.PushBack(&g);
} else {
@@ -374,22 +375,15 @@ namespace NKikimr::NBsController {
}
}
}
- for (const auto& [vdiskId, status, onlyPhantomsRemain] : ev->Get()->VDiskStatusUpdate) {
- if (const auto it = Groups.find(vdiskId.GroupID); it != Groups.end()) {
+ for (const auto& item : ev->Get()->VDiskStatusUpdate) {
+ if (const auto it = Groups.find(item.VDiskId.GroupID); it != Groups.end()) {
auto& group = it->second;
- if (const auto it = group.Content.VDisks.find(vdiskId); it != group.Content.VDisks.end()) {
- it->second.VDiskStatus = status;
- it->second.OnlyPhantomsRemain = onlyPhantomsRemain;
- group.VDiskStatus[vdiskId].Update(status, now);
- }
- }
- }
- for (auto& [vdiskId, isReady] : ev->Get()->VDiskIsReadyUpdate) {
- if (const auto it = Groups.find(vdiskId.GroupID); it != Groups.end()) {
- auto& group = it->second;
- if (const auto it = group.Content.VDisks.find(vdiskId); it != group.Content.VDisks.end() &&
- vdiskId.GroupGeneration == it->first.GroupGeneration) {
- it->second.IsReady = isReady;
+ if (const auto it = group.Content.VDisks.find(item.VDiskId); it != group.Content.VDisks.end()) {
+ auto& vdisk = it->second;
+ vdisk.OnlyPhantomsRemain = item.OnlyPhantomsRemain.value_or(vdisk.OnlyPhantomsRemain);
+ vdisk.IsReady = item.IsReady.value_or(vdisk.IsReady);
+ vdisk.ReadySince = item.ReadySince.value_or(vdisk.ReadySince);
+ vdisk.VDiskStatus = item.VDiskStatus.value_or(vdisk.VDiskStatus);
}
}
}
@@ -397,7 +391,7 @@ namespace NKikimr::NBsController {
}
void CheckGroups() {
- const TInstant now = TActivationContext::Now();
+ const TMonotonic now = TActivationContext::Monotonic();
ui64 counter = 0;
@@ -412,10 +406,9 @@ namespace NKikimr::NBsController {
// check if it is possible to move anything out
bool isSelfHealReasonDecommit;
- if (const auto v = FindVDiskToReplace(group.VDiskStatus, group.Content, now, group.Topology.get(),
- &isSelfHealReasonDecommit)) {
+ if (const auto v = FindVDiskToReplace(group.Content, now, group.Topology.get(), &isSelfHealReasonDecommit)) {
group.ReassignerActorId = Register(new TReassignerActor(ControllerId, group.GroupId, group.Content,
- *v, group.Topology, isSelfHealReasonDecommit));
+ *v, group.Topology, isSelfHealReasonDecommit, DonorMode));
} else {
++counter; // this group can't be reassigned right now
}
@@ -430,7 +423,7 @@ namespace NKikimr::NBsController {
bool allDisksAreFullyOperational = true;
for (const auto& [vdiskId, vdisk] : group.Content.VDisks) {
- if (vdisk.Bad || vdisk.Faulty || !vdisk.IsReady) {
+ if (vdisk.Bad || vdisk.Faulty || !IsReady(vdisk, now)) {
// don't sanitize groups with non-operational or replicating disks
allDisksAreFullyOperational = false;
break;
@@ -448,7 +441,7 @@ namespace NKikimr::NBsController {
ADD_RECORD_WITH_TIMESTAMP_TO_OPERATION_LOG(GroupLayoutSanitizerOperationLog,
"Start sanitizing GroupId# " << group.GroupId << " GroupGeneration# " << group.Content.Generation);
group.ReassignerActorId = Register(new TReassignerActor(ControllerId, group.GroupId, group.Content,
- std::nullopt, group.Topology, false /*isSelfHealReasonDecommit*/));
+ std::nullopt, group.Topology, false /*isSelfHealReasonDecommit*/, DonorMode));
}
}
}
@@ -497,9 +490,8 @@ namespace NKikimr::NBsController {
}
}
- std::optional<TVDiskID> FindVDiskToReplace(const THashMap<TVDiskID, TVDiskStatusTracker>& tracker,
- const TEvControllerUpdateSelfHealInfo::TGroupContent& content, TInstant now,
- TBlobStorageGroupInfo::TTopology *topology, bool *isSelfHealReasonDecommit) {
+ std::optional<TVDiskID> FindVDiskToReplace(const TEvControllerUpdateSelfHealInfo::TGroupContent& content,
+ TMonotonic now, TBlobStorageGroupInfo::TTopology *topology, bool *isSelfHealReasonDecommit) {
// main idea of selfhealing is step-by-step healing of bad group; we can allow healing of group with more
// than one disk missing, but we should not move next faulty disk until previous one is replicated, at least
// partially (meaning only phantoms left)
@@ -524,9 +516,7 @@ namespace NKikimr::NBsController {
break;
}
- auto it = tracker.find(vdiskId);
- Y_ABORT_UNLESS(it != tracker.end());
- if (it->second.GetStatus(now) != NKikimrBlobStorage::EVDiskStatus::READY) {
+ if (!IsReady(vdisk, now)) {
failedByReadiness |= {topology, vdiskId};
}
if (vdisk.Bad) {
@@ -559,7 +549,7 @@ namespace NKikimr::NBsController {
auto& group = it->second;
group.ReassignerActorId = {};
- const TInstant now = TActivationContext::Now();
+ const TMonotonic now = TActivationContext::Monotonic();
if (ev->Get()->Success) {
group.NextRetryTimestamp = now;
group.RetryTimeout = MinRetryTimeout;
@@ -608,8 +598,6 @@ namespace NKikimr::NBsController {
}
void RenderMonPage(IOutputStream& out, bool selfHealEnabled) {
- const TInstant now = TActivationContext::Now();
-
HTML(out) {
TAG(TH2) {
out << "BlobStorage Controller";
@@ -697,15 +685,7 @@ namespace NKikimr::NBsController {
out << "<br/>";
out << vdisk.VDiskStatus;
out << "<br/><strong>";
- if (const auto it = group.VDiskStatus.find(vdiskId); it != group.VDiskStatus.end()) {
- if (const auto& status = it->second.GetStatus(now)) {
- out << *status;
- } else {
- out << "unsure";
- }
- } else {
- out << "?";
- }
+ out << (vdisk.IsReady ? "ready" : "not_ready");
out << "</strong>";
}
}
@@ -811,15 +791,7 @@ namespace NKikimr::NBsController {
out << "<br/>";
out << vdisk.VDiskStatus;
out << "<br/><strong>";
- if (const auto it = group.VDiskStatus.find(vdiskId); it != group.VDiskStatus.end()) {
- if (const auto& status = it->second.GetStatus(now)) {
- out << *status;
- } else {
- out << "unsure";
- }
- } else {
- out << "?";
- }
+ out << (vdisk.IsReady ? "ready" : "not_ready");
out << "</strong>";
}
}
@@ -870,7 +842,8 @@ namespace NKikimr::NBsController {
IActor *TBlobStorageController::CreateSelfHealActor() {
Y_ABORT_UNLESS(HostRecords);
- return new TSelfHealActor(TabletID(), SelfHealUnreassignableGroups, HostRecords);
+ return new TSelfHealActor(TabletID(), SelfHealUnreassignableGroups, HostRecords, GroupLayoutSanitizerEnabled,
+ AllowMultipleRealmsOccupation, DonorMode);
}
void TBlobStorageController::InitializeSelfHealState() {
@@ -918,6 +891,7 @@ namespace NKikimr::NBsController {
slot->PDisk->IsSelfHealReasonDecommit(),
slot->OnlyPhantomsRemain,
slot->IsReady,
+ TMonotonic::Zero(),
slot->Status,
};
}
@@ -933,7 +907,7 @@ namespace NKikimr::NBsController {
std::unique_ptr<TEvPrivate::TEvDropDonor> dropDonorEv;
- auto ev = MakeHolder<TEvControllerUpdateSelfHealInfo>();
+ std::vector<TEvControllerUpdateSelfHealInfo::TVDiskStatusUpdate> updates;
for (const auto& m : s) {
const TVSlotId vslotId(m.GetNodeId(), m.GetPDiskId(), m.GetVSlotId());
const auto vdiskId = VDiskIDFromVDiskID(m.GetVDiskId());
@@ -946,14 +920,18 @@ namespace NKikimr::NBsController {
slot->SetStatus(m.GetStatus(), mono, now, m.GetOnlyPhantomsRemain());
if (slot->IsReady != wasReady) {
ScrubState.UpdateVDiskState(slot);
- ev->VDiskIsReadyUpdate.emplace_back(vdiskId, slot->IsReady);
if (wasReady) {
NotReadyVSlotIds.insert(slot->VSlotId);
}
}
timingQ.emplace_back(*slot);
}
- ev->VDiskStatusUpdate.emplace_back(vdiskId, m.GetStatus(), m.GetOnlyPhantomsRemain());
+ updates.push_back({
+ .VDiskId = vdiskId,
+ .OnlyPhantomsRemain = slot->OnlyPhantomsRemain,
+ .IsReady = slot->IsReady,
+ .VDiskStatus = slot->Status,
+ });
if (!was && slot->IsOperational() && !group->SeenOperational) {
groups.insert(const_cast<TGroupInfo*>(group));
}
@@ -970,11 +948,12 @@ namespace NKikimr::NBsController {
}
}
if (const auto it = StaticVSlots.find(vslotId); it != StaticVSlots.end() && it->second.VDiskId == vdiskId) {
- it->second.VDiskStatus = m.GetStatus();
- if (it->second.VDiskStatus == NKikimrBlobStorage::EVDiskStatus::READY) {
- it->second.ReadySince = Min(it->second.ReadySince, mono + ReadyStablePeriod);
+ auto& vslot = it->second;
+ vslot.VDiskStatus = m.GetStatus();
+ if (vslot.VDiskStatus == NKikimrBlobStorage::EVDiskStatus::READY) {
+ vslot.ReadySince = Min(vslot.ReadySince, mono + ReadyStablePeriod);
} else {
- it->second.ReadySince = TMonotonic::Max();
+ vslot.ReadySince = TMonotonic::Max();
}
}
}
@@ -984,8 +963,8 @@ namespace NKikimr::NBsController {
}
// issue updated statuses to self-healer
- if (ev->VDiskStatusUpdate) {
- Send(SelfHealId, ev.Release());
+ if (!updates.empty()) {
+ Send(SelfHealId, new TEvControllerUpdateSelfHealInfo(std::move(updates)));
}
// update operational status for groups
diff --git a/ydb/core/mind/bscontroller/self_heal.h b/ydb/core/mind/bscontroller/self_heal.h
index 946f822ad1..41432ebf44 100644
--- a/ydb/core/mind/bscontroller/self_heal.h
+++ b/ydb/core/mind/bscontroller/self_heal.h
@@ -18,6 +18,7 @@ namespace NKikimr::NBsController {
bool IsSelfHealReasonDecommit;
bool OnlyPhantomsRemain;
bool IsReady;
+ TMonotonic ReadySince;
NKikimrBlobStorage::EVDiskStatus VDiskStatus;
};
ui32 Generation;
@@ -25,14 +26,27 @@ namespace NKikimr::NBsController {
TMap<TVDiskID, TVDiskInfo> VDisks;
std::shared_ptr<TGroupGeometryInfo> Geometry;
};
+ struct TVDiskStatusUpdate {
+ TVDiskID VDiskId;
+ std::optional<bool> OnlyPhantomsRemain;
+ std::optional<bool> IsReady;
+ std::optional<TMonotonic> ReadySince;
+ std::optional<NKikimrBlobStorage::EVDiskStatus> VDiskStatus;
+ };
THashMap<TGroupId, std::optional<TGroupContent>> GroupsToUpdate; // groups with faulty groups that are changed or got faulty PDisks for the first time
- TVector<std::tuple<TVDiskID, NKikimrBlobStorage::EVDiskStatus, bool>> VDiskStatusUpdate;
- TVector<std::pair<TVDiskID, bool>> VDiskIsReadyUpdate;
+ std::vector<TVDiskStatusUpdate> VDiskStatusUpdate;
std::optional<bool> GroupLayoutSanitizerEnabled;
std::optional<bool> AllowMultipleRealmsOccupation;
+ std::optional<bool> DonorMode;
ui64 ConfigTxSeqNo = 0;
+
+ TEvControllerUpdateSelfHealInfo() = default;
+
+ TEvControllerUpdateSelfHealInfo(std::vector<TVDiskStatusUpdate>&& updates)
+ : VDiskStatusUpdate(std::move(updates))
+ {}
};
} // NKikimr::NBsController
diff --git a/ydb/core/mind/bscontroller/ut_bscontroller/main.cpp b/ydb/core/mind/bscontroller/ut_bscontroller/main.cpp
index 74dee6510e..aab92e4555 100644
--- a/ydb/core/mind/bscontroller/ut_bscontroller/main.cpp
+++ b/ydb/core/mind/bscontroller/ut_bscontroller/main.cpp
@@ -5,7 +5,6 @@
#include <ydb/core/mind/bscontroller/indir.h>
#include <ydb/core/mind/bscontroller/types.h>
#include <ydb/core/mind/bscontroller/ut_helpers.h>
-#include <ydb/core/mind/bscontroller/vdisk_status_tracker.h>
#include <ydb/core/protos/blobstorage_config.pb.h>
#include <ydb/core/protos/blobstorage_distributed_config.pb.h>
#include <ydb/core/testlib/basics/helpers.h>
@@ -1105,28 +1104,4 @@ Y_UNIT_TEST_SUITE(BsControllerConfig) {
}
}
}
-
- Y_UNIT_TEST(VDiskStatusTracker) {
- using E = NKikimrBlobStorage::EVDiskStatus;
- TInstant base = TInstant::Zero();
- TVDiskStatusTracker tracker(TDuration::Seconds(60));
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(0)), std::nullopt);
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(75)), std::nullopt);
- tracker.Update(E::INIT_PENDING, base + TDuration::Seconds(10));
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(15)), std::nullopt);
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(75)), E::INIT_PENDING);
- tracker.Update(E::REPLICATING, base + TDuration::Seconds(20));
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(15)), std::nullopt);
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(75)), std::nullopt);
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(85)), E::REPLICATING);
- tracker.Update(E::READY, base + TDuration::Seconds(30));
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(15)), std::nullopt);
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(75)), std::nullopt);
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(85)), std::nullopt);
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(95)), E::READY);
- tracker.Update(E::ERROR, base + TDuration::Seconds(40));
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(75)), std::nullopt);
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(85)), std::nullopt);
- UNIT_ASSERT_VALUES_EQUAL(tracker.GetStatus(base + TDuration::Seconds(95)), std::nullopt);
- }
}
diff --git a/ydb/core/mind/bscontroller/ut_selfheal/self_heal_actor_ut.cpp b/ydb/core/mind/bscontroller/ut_selfheal/self_heal_actor_ut.cpp
index 2f178b6fa4..6aebfd584e 100644
--- a/ydb/core/mind/bscontroller/ut_selfheal/self_heal_actor_ut.cpp
+++ b/ydb/core/mind/bscontroller/ut_selfheal/self_heal_actor_ut.cpp
@@ -63,7 +63,12 @@ TEvControllerUpdateSelfHealInfo::TGroupContent Convert(const TIntrusivePtr<TBlob
for (ui32 i = 0; i < info->GetTotalVDisksNum(); ++i) {
auto& x = res.VDisks[info->GetVDiskId(i)];
x.Location = {1, 1000 + i, 1000};
- x.Faulty = faultyIndexes.count(i);
+ x.Faulty = x.Bad = faultyIndexes.count(i);
+ x.Decommitted = false;
+ x.IsSelfHealReasonDecommit = false;
+ x.OnlyPhantomsRemain = false;
+ x.IsReady = !x.Faulty;
+ x.ReadySince = TMonotonic::Zero();
x.VDiskStatus = i < status.size() ? status[i] : E::READY;
}
return res;
diff --git a/ydb/core/mind/bscontroller/vdisk_status_tracker.h b/ydb/core/mind/bscontroller/vdisk_status_tracker.h
deleted file mode 100644
index 35d626ed15..0000000000
--- a/ydb/core/mind/bscontroller/vdisk_status_tracker.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#pragma once
-
-#include "defs.h"
-
-namespace NKikimr::NBsController {
-
- class TVDiskStatusTracker {
- NKikimrBlobStorage::EVDiskStatus Status;
- TInstant SwitchTime = TInstant::Max();
- const TDuration Threshold;
-
- public:
- TVDiskStatusTracker(TDuration threshold = TDuration::Seconds(60))
- : Threshold(threshold)
- {}
-
- void Update(NKikimrBlobStorage::EVDiskStatus status, TInstant now) {
- if (SwitchTime == TInstant::Max() || status != Status) {
- Status = status;
- SwitchTime = now;
- }
- }
-
- std::optional<NKikimrBlobStorage::EVDiskStatus> GetStatus(TInstant now) const {
- return SwitchTime <= now - Threshold ? std::make_optional(Status) : std::nullopt;
- }
- };
-
-} // NKikimr::NBsController
diff --git a/ydb/core/mind/bscontroller/ya.make b/ydb/core/mind/bscontroller/ya.make
index 79a16d0963..ff23918e38 100644
--- a/ydb/core/mind/bscontroller/ya.make
+++ b/ydb/core/mind/bscontroller/ya.make
@@ -57,7 +57,6 @@ SRCS(
update_group_latencies.cpp
update_last_seen_ready.cpp
update_seen_operational.cpp
- vdisk_status_tracker.h
virtual_group.cpp
)