aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryuryalekseev <yuryalekseev@yandex-team.com>2023-02-20 08:42:56 +0300
committeryuryalekseev <yuryalekseev@yandex-team.com>2023-02-20 08:42:56 +0300
commita6434be90a54e983eca0c6a616c48d740289b1f3 (patch)
tree35d731f0862e5d6ae58a2637d1663410a00c55d6
parent253ad6a7fcd29e12846cc5cd00e6a5f2246e205e (diff)
downloadydb-a6434be90a54e983eca0c6a616c48d740289b1f3.tar.gz
Tidy up TDriveLifeStage.E.
-rw-r--r--ydb/core/mind/bscontroller/cmds_drive_status.cpp16
-rw-r--r--ydb/core/mind/bscontroller/config_fit_pdisks.cpp2
-rw-r--r--ydb/core/mind/bscontroller/impl.h26
-rw-r--r--ydb/core/mind/bscontroller/register_node.cpp4
-rw-r--r--ydb/core/protos/blobstorage_config.proto8
-rw-r--r--ydb/core/protos/counters_bs_controller.proto8
6 files changed, 26 insertions, 38 deletions
diff --git a/ydb/core/mind/bscontroller/cmds_drive_status.cpp b/ydb/core/mind/bscontroller/cmds_drive_status.cpp
index 664111a18b..43c42725a2 100644
--- a/ydb/core/mind/bscontroller/cmds_drive_status.cpp
+++ b/ydb/core/mind/bscontroller/cmds_drive_status.cpp
@@ -102,8 +102,8 @@ namespace NKikimr::NBsController {
}
switch (driveInfo->LifeStage) {
- case NKikimrBlobStorage::TDriveLifeStage::SEEN_ON_NODE:
- case NKikimrBlobStorage::TDriveLifeStage::REMOVED_FROM_BSC:
+ case NKikimrBlobStorage::TDriveLifeStage::FREE:
+ case NKikimrBlobStorage::TDriveLifeStage::REMOVED_BY_DSTOOL:
break;
default:
throw TExAlready() << "Device with such serial already exists in BSC database in lifeStage " << driveInfo->LifeStage;
@@ -128,7 +128,7 @@ namespace NKikimr::NBsController {
throw TExError() << "Couldn't serialize PDiskConfig for disk with serial number" << TErrorParams::DiskSerialNumber(serial);
}
driveInfoMutable->PDiskConfig = config;
- driveInfoMutable->LifeStage = NKikimrBlobStorage::TDriveLifeStage::ADDED_TO_BSC;
+ driveInfoMutable->LifeStage = NKikimrBlobStorage::TDriveLifeStage::ADDED_BY_DSTOOL;
Fit.Boxes.insert(cmd.GetBoxId());
@@ -146,16 +146,16 @@ namespace NKikimr::NBsController {
throw TExError() << "Couldn't find disk with serial number" << TErrorParams::DiskSerialNumber(serial);
}
- if (driveInfo->LifeStage == NKikimrBlobStorage::TDriveLifeStage::SEEN_ON_NODE) {
+ if (driveInfo->LifeStage == NKikimrBlobStorage::TDriveLifeStage::FREE) {
throw TExError() << "Disk with serial number" << TErrorParams::DiskSerialNumber(serial) << " hasn't been added to BSC yet ";
}
- if (driveInfo->LifeStage == NKikimrBlobStorage::TDriveLifeStage::REMOVED_FROM_BSC) {
+ if (driveInfo->LifeStage == NKikimrBlobStorage::TDriveLifeStage::REMOVED_BY_DSTOOL) {
throw TExError() << "Disk with serial number" << TErrorParams::DiskSerialNumber(serial) << " has already been removed";
}
auto driveInfoMutable = DrivesSerials.FindForUpdate(serial);
- driveInfoMutable->LifeStage = NKikimrBlobStorage::TDriveLifeStage::REMOVED_FROM_BSC;
+ driveInfoMutable->LifeStage = NKikimrBlobStorage::TDriveLifeStage::REMOVED_BY_DSTOOL;
Fit.Boxes.insert(driveInfo->BoxId);
@@ -169,11 +169,11 @@ namespace NKikimr::NBsController {
if (auto driveInfo = DrivesSerials.Find(serial)) {
switch (driveInfo->LifeStage) {
- case NKikimrBlobStorage::TDriveLifeStage::REMOVED_FROM_BSC:
+ case NKikimrBlobStorage::TDriveLifeStage::REMOVED_BY_DSTOOL:
DrivesSerials.DeleteExistingEntry(serial);
break;
default:
- throw TExError() << "Drive not in {REMOVED} lifestage and cannot be forgotten. Remove it first";
+ throw TExError() << "Drive not in REMOVED_BY_DSTOOL lifestage and cannot be forgotten. Remove it first";
}
} else {
throw TExAlready() << "Drive is unknown for BS_CONTROLLER and cannot be forgotten";
diff --git a/ydb/core/mind/bscontroller/config_fit_pdisks.cpp b/ydb/core/mind/bscontroller/config_fit_pdisks.cpp
index 20fe4de904..089dc98359 100644
--- a/ydb/core/mind/bscontroller/config_fit_pdisks.cpp
+++ b/ydb/core/mind/bscontroller/config_fit_pdisks.cpp
@@ -217,7 +217,7 @@ namespace NKikimr {
return true;
}
- if (driveInfo.LifeStage != NKikimrBlobStorage::TDriveLifeStage::ADDED_TO_BSC) {
+ if (driveInfo.LifeStage != NKikimrBlobStorage::TDriveLifeStage::ADDED_BY_DSTOOL) {
return true;
}
diff --git a/ydb/core/mind/bscontroller/impl.h b/ydb/core/mind/bscontroller/impl.h
index 56f287f3ce..e1573e67ad 100644
--- a/ydb/core/mind/bscontroller/impl.h
+++ b/ydb/core/mind/bscontroller/impl.h
@@ -1279,7 +1279,7 @@ public:
TMaybe<Table::NodeId::Type> NodeId;
TMaybe<Table::PDiskId::Type> PDiskId;
TMaybe<Table::Guid::Type> Guid;
- Table::LifeStage::Type LifeStage = NKikimrBlobStorage::TDriveLifeStage::UNKNOWN;
+ Table::LifeStage::Type LifeStage = NKikimrBlobStorage::TDriveLifeStage::FREE;
Table::Kind::Type Kind = 0;
Table::PDiskType::Type PDiskType = PDiskTypeToPDiskType(NPDisk::DEVICE_TYPE_UNKNOWN);
TMaybe<Table::PDiskConfig::Type> PDiskConfig;
@@ -1970,36 +1970,28 @@ public:
counters[NBlobStorageController::COUNTER_PDISKS_WITHOUT_EXPECTED_SLOT_COUNT].Set(numWithoutSlotCount);
counters[NBlobStorageController::COUNTER_PDISKS_WITHOUT_EXPECTED_SERIAL].Set(numWithoutSerial);
- ui32 numUnknown = 0;
- ui32 numSeen = 0;
+ ui32 numFree = 0;
ui32 numAdded = 0;
ui32 numRemoved = 0;
- ui32 numError = 0;
for (const auto& [serial, driveInfo] : DrivesSerials) {
switch (driveInfo->LifeStage) {
- case NKikimrBlobStorage::TDriveLifeStage::SEEN_ON_NODE:
- ++numSeen;
+ case NKikimrBlobStorage::TDriveLifeStage::FREE:
+ ++numFree;
break;
- case NKikimrBlobStorage::TDriveLifeStage::ADDED_TO_BSC:
+ case NKikimrBlobStorage::TDriveLifeStage::ADDED_BY_DSTOOL:
++numAdded;
break;
- case NKikimrBlobStorage::TDriveLifeStage::REMOVED_FROM_BSC:
+ case NKikimrBlobStorage::TDriveLifeStage::REMOVED_BY_DSTOOL:
++numRemoved;
break;
- case NKikimrBlobStorage::TDriveLifeStage::ERROR:
- ++numError;
- break;
default:
- ++numUnknown;
break;
}
}
- counters[NBlobStorageController::COUNTER_DRIVE_SERIAL_SEEN_ON_NODE].Set(numSeen);
- counters[NBlobStorageController::COUNTER_DRIVE_SERIAL_ADDED_TO_BSC].Set(numAdded);
- counters[NBlobStorageController::COUNTER_DRIVE_SERIAL_REMOVED_FROM_BSC].Set(numRemoved);
- counters[NBlobStorageController::COUNTER_DRIVE_SERIAL_ERROR].Set(numError);
- counters[NBlobStorageController::COUNTER_DRIVE_SERIAL_UNKNOWN].Set(numUnknown);
+ counters[NBlobStorageController::COUNTER_DRIVE_SERIAL_FREE].Set(numFree);
+ counters[NBlobStorageController::COUNTER_DRIVE_SERIAL_ADDED_BY_DSTOOL].Set(numAdded);
+ counters[NBlobStorageController::COUNTER_DRIVE_SERIAL_REMOVED_BY_DSTOOL].Set(numRemoved);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/ydb/core/mind/bscontroller/register_node.cpp b/ydb/core/mind/bscontroller/register_node.cpp
index c763d2e797..757fe6f452 100644
--- a/ydb/core/mind/bscontroller/register_node.cpp
+++ b/ydb/core/mind/bscontroller/register_node.cpp
@@ -110,12 +110,12 @@ class TBlobStorageController::TTxUpdateNodeDrives
auto it = Self->DrivesSerials.find(serial);
if (it == Self->DrivesSerials.end()) {
auto newInfo = MakeHolder<TDriveSerialInfo>();
- newInfo->LifeStage = NKikimrBlobStorage::TDriveLifeStage::SEEN_ON_NODE;
+ newInfo->LifeStage = NKikimrBlobStorage::TDriveLifeStage::FREE;
newInfo->NodeId = nodeId;
newInfo->Path = data.GetPath();
newInfo->PDiskType = data.GetDeviceType();
Self->DrivesSerials.emplace(serial, std::move(newInfo));
- } else if (it->second->LifeStage == NKikimrBlobStorage::TDriveLifeStage::ADDED_TO_BSC) {
+ } else if (it->second->LifeStage == NKikimrBlobStorage::TDriveLifeStage::ADDED_BY_DSTOOL) {
if (it->second->NodeId != nodeId) {
STLOG(PRI_ERROR, BS_CONTROLLER, BSCTXRN03,
"Received drive from NewNodeId, but drive is reported as placed in OldNodeId",
diff --git a/ydb/core/protos/blobstorage_config.proto b/ydb/core/protos/blobstorage_config.proto
index 40d5b9f9e9..f1ff971266 100644
--- a/ydb/core/protos/blobstorage_config.proto
+++ b/ydb/core/protos/blobstorage_config.proto
@@ -219,11 +219,9 @@ message TGroupStatus {
message TDriveLifeStage {
enum E {
- UNKNOWN = 0; // life stage is unknown (default)
- SEEN_ON_NODE = 1; // disk drive has been seen on a node, but is not added to BSC yet
- ADDED_TO_BSC = 2; // disk drive has been added to BSC
- REMOVED_FROM_BSC = 3; // disk drive has been removed from BSC
- ERROR = 4; // drive was moved between nodes with allocated VDisks
+ FREE = 0; // disk drive has been seen on a node, but is not added to BSC yet
+ ADDED_BY_DSTOOL = 1; // disk drive has been added to BSC
+ REMOVED_BY_DSTOOL = 2; // disk drive has been removed from BSC
}
}
diff --git a/ydb/core/protos/counters_bs_controller.proto b/ydb/core/protos/counters_bs_controller.proto
index 0b1186f2ec..e4dc184df4 100644
--- a/ydb/core/protos/counters_bs_controller.proto
+++ b/ydb/core/protos/counters_bs_controller.proto
@@ -17,9 +17,9 @@ enum ESimpleCounters {
COUNTER_SLOTS_ON_TO_BE_REMOVED_DISKS = 7 [(CounterOpts) = {Name: "SlotsOnToBeRemovedDisks"}];
COUNTER_BYTES_ON_TO_BE_REMOVED_DISKS = 8 [(CounterOpts) = {Name: "BytesOnToBeRemovedDisks"}];
COUNTER_PDISKS_WITHOUT_EXPECTED_SERIAL = 9 [(CounterOpts) = {Name: "PDisksWithoutExpectedSerial"}];
- COUNTER_DRIVE_SERIAL_SEEN_ON_NODE = 10 [(CounterOpts) = {Name: "DriveSerialSeenOnNode"}];
- COUNTER_DRIVE_SERIAL_REMOVED_FROM_BSC = 11 [(CounterOpts) = {Name: "DriveSerialRemovedFromBsc"}];
- COUNTER_DRIVE_SERIAL_ERROR = 12 [(CounterOpts) = {Name: "DriveSerialError"}];
+ COUNTER_DRIVE_SERIAL_FREE = 10 [(CounterOpts) = {Name: "DriveSerialFree"}];
+ COUNTER_DRIVE_SERIAL_REMOVED_BY_DSTOOL = 11 [(CounterOpts) = {Name: "DriveSerialRemovedByDstool"}];
+ COUNTER_DRIVE_SERIAL_ADDED_BY_DSTOOL = 12 [(CounterOpts) = {Name: "DriveSerialAddedByDstool"}];
COUNTER_DISK_SCRUB_WAITING_FOR_START = 13 [(CounterOpts) = {Name: "DiskScrubWaitingForStart"}];
COUNTER_DISK_SCRUB_RUNNING = 14 [(CounterOpts) = {Name: "DiskScrubRunning"}];
COUNTER_DISK_SCRUB_IN_PROGRESS = 15 [(CounterOpts) = {Name: "DiskScrubInProgress"}];
@@ -28,8 +28,6 @@ enum ESimpleCounters {
COUNTER_DISK_SCRUB_CUR_DISKS = 18 [(CounterOpts) = {Name: "CurrentlyScrubbedDisks"}];
COUNTER_DISK_SCRUB_CUR_GROUPS = 19 [(CounterOpts) = {Name: "CurrentlyScrubbedGroups"}];
COUNTER_SELF_HEAL_UNREASSIGNABLE_GROUPS = 20 [(CounterOpts) = {Name: "SelfHealUnreassignableGroups"}];
- COUNTER_DRIVE_SERIAL_UNKNOWN = 21 [(CounterOpts) = {Name: "DriveSerialUnknown"}];
- COUNTER_DRIVE_SERIAL_ADDED_TO_BSC = 22 [(CounterOpts) = {Name: "DriveSerialAddedToBsc"}];
}
enum ECumulativeCounters {