aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryuryalekseev <yuryalekseev@yandex-team.com>2023-02-08 17:39:03 +0300
committeryuryalekseev <yuryalekseev@yandex-team.com>2023-02-08 17:39:03 +0300
commit9d9b0f8aa31ebf4ed8483deab6ea0b67ce59abcb (patch)
tree622ab7e9b6e1aad31d6d09ceaeb674090a6472ca
parentcea6e2dbf8b1bdcc08f4ca7b2291d9898249fa06 (diff)
downloadydb-9d9b0f8aa31ebf4ed8483deab6ea0b67ce59abcb.tar.gz
Save path in DrivesSerials and use it.
-rw-r--r--ydb/core/mind/bscontroller/cmds_drive_status.cpp2
-rw-r--r--ydb/core/mind/bscontroller/config_fit_pdisks.cpp14
-rw-r--r--ydb/core/mind/bscontroller/impl.h7
-rw-r--r--ydb/core/mind/bscontroller/monitoring.cpp2
-rw-r--r--ydb/core/mind/bscontroller/scheme.h3
-rw-r--r--ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_bs_controller_/flat_bs_controller.schema8
6 files changed, 27 insertions, 9 deletions
diff --git a/ydb/core/mind/bscontroller/cmds_drive_status.cpp b/ydb/core/mind/bscontroller/cmds_drive_status.cpp
index 6dfa07dbd0..7c32168085 100644
--- a/ydb/core/mind/bscontroller/cmds_drive_status.cpp
+++ b/ydb/core/mind/bscontroller/cmds_drive_status.cpp
@@ -140,6 +140,7 @@ namespace NKikimr::NBsController {
driveInfoMutable->PDiskConfig = config;
driveInfoMutable->LifeStage = NKikimrBlobStorage::TDriveLifeStage::ADDED;
driveInfoMutable->NodeId = nodeId;
+ driveInfoMutable->Path = driveIt->second.Path;
Fit.Boxes.insert(boxId);
@@ -165,6 +166,7 @@ namespace NKikimr::NBsController {
driveInfoMutable->NodeId.Clear();
driveInfoMutable->PDiskId.Clear();
driveInfoMutable->LifeStage = NKikimrBlobStorage::TDriveLifeStage::REMOVED;
+ driveInfoMutable->Path.Clear();
Fit.Boxes.insert(driveInfo->BoxId);
diff --git a/ydb/core/mind/bscontroller/config_fit_pdisks.cpp b/ydb/core/mind/bscontroller/config_fit_pdisks.cpp
index 2cd1223e91..70248e1bd9 100644
--- a/ydb/core/mind/bscontroller/config_fit_pdisks.cpp
+++ b/ydb/core/mind/bscontroller/config_fit_pdisks.cpp
@@ -112,7 +112,7 @@ namespace NKikimr {
}
// return TString not const TString& to make sure we never use dangling reference
- static TString GetDiskPathFromNode(ui32 nodeId, const TString& serialNumber, const TBlobStorageController::TConfigState& state, bool throwOnError = false) {
+ TString GetDiskPathFromNode(ui32 nodeId, const TString& serialNumber, const TBlobStorageController::TConfigState& state, bool throwOnError = false) {
if (auto nodeIt = state.Nodes.Get().find(nodeId); nodeIt != state.Nodes.Get().end()) {
for (const auto& [_, driveData] : nodeIt->second.KnownDrives) {
if (serialNumber == driveData.SerialNumber) {
@@ -132,7 +132,7 @@ namespace NKikimr {
}
// return TString not const TString& to make sure we never use dangling reference
- static TString GetDiskSerialNumberFromNode(ui32 nodeId, const TString& path, const TBlobStorageController::TConfigState& state, bool throwOnError = false) {
+ TString GetDiskSerialNumberFromNode(ui32 nodeId, const TString& path, const TBlobStorageController::TConfigState& state, bool throwOnError = false) {
if (auto nodeIt = state.Nodes.Get().find(nodeId); nodeIt != state.Nodes.Get().end()) {
for (const auto& [_, driveData] : nodeIt->second.KnownDrives) {
if (path == driveData.Path) {
@@ -233,15 +233,19 @@ namespace NKikimr {
return true;
}
- auto path = GetDiskPathFromNode(*nodeId, serial, state, /* throwOnError */ true);
+ auto path = driveInfo.Path;
+ if (!path) {
+ STLOG(PRI_ERROR, BS_CONTROLLER, BSCFP07, "Couldn't get path for disk with serial number.", (SerialNumber, serial.Serial));
+ return true;
+ }
TDiskInfo disk;
disk.BoxId = driveInfo.BoxId;
disk.HostId = *hostId;
- disk.LastSeenPath = path;
+ disk.LastSeenPath = TString();
disk.LastSeenSerial = TString();
disk.NodeId = *nodeId;
- disk.Path = path;
+ disk.Path = *path;
disk.PDiskCategory = TPDiskCategory(PDiskTypeToPDiskType(driveInfo.PDiskType), driveInfo.Kind);
disk.PDiskConfig = driveInfo.PDiskConfig.GetOrElse(TString());
disk.ReadCentric = false;
diff --git a/ydb/core/mind/bscontroller/impl.h b/ydb/core/mind/bscontroller/impl.h
index 50cfa19e6d..be43cf905e 100644
--- a/ydb/core/mind/bscontroller/impl.h
+++ b/ydb/core/mind/bscontroller/impl.h
@@ -1284,6 +1284,7 @@ public:
Table::Kind::Type Kind = 0;
Table::PDiskType::Type PDiskType = PDiskTypeToPDiskType(NPDisk::DEVICE_TYPE_UNKNOWN);
TMaybe<Table::PDiskConfig::Type> PDiskConfig;
+ TMaybe<Table::Path::Type> Path;
TDriveSerialInfo() = default;
TDriveSerialInfo(const TDriveSerialInfo&) = default;
@@ -1303,7 +1304,8 @@ public:
Table::LifeStage,
Table::Kind,
Table::PDiskType,
- Table::PDiskConfig
+ Table::PDiskConfig,
+ Table::Path
> adapter(
&TDriveSerialInfo::BoxId,
&TDriveSerialInfo::NodeId,
@@ -1312,7 +1314,8 @@ public:
&TDriveSerialInfo::LifeStage,
&TDriveSerialInfo::Kind,
&TDriveSerialInfo::PDiskType,
- &TDriveSerialInfo::PDiskConfig
+ &TDriveSerialInfo::PDiskConfig,
+ &TDriveSerialInfo::Path
);
callback(&adapter);
}
diff --git a/ydb/core/mind/bscontroller/monitoring.cpp b/ydb/core/mind/bscontroller/monitoring.cpp
index 5f1bf21ebc..0de768c090 100644
--- a/ydb/core/mind/bscontroller/monitoring.cpp
+++ b/ydb/core/mind/bscontroller/monitoring.cpp
@@ -1160,6 +1160,7 @@ void TBlobStorageController::RenderInternalTables(IOutputStream& out, const TStr
TABLEH() { out << "LifeStage"; }
TABLEH() { out << "Kind"; }
TABLEH() { out << "PDiskType"; }
+ TABLEH() { out << "Path"; }
}
}
TABLEBODY() {
@@ -1172,6 +1173,7 @@ void TBlobStorageController::RenderInternalTables(IOutputStream& out, const TStr
TABLED() { out << info->LifeStage; }
TABLED() { out << info->Kind; }
TABLED() { out << info->PDiskType; }
+ TABLED() { out << PrintMaybe(info->Path); }
}
}
}
diff --git a/ydb/core/mind/bscontroller/scheme.h b/ydb/core/mind/bscontroller/scheme.h
index 31a1826042..5436761eea 100644
--- a/ydb/core/mind/bscontroller/scheme.h
+++ b/ydb/core/mind/bscontroller/scheme.h
@@ -382,9 +382,10 @@ struct Schema : NIceDb::Schema {
struct Kind : Column<7, HostConfigDrive::Kind::ColumnType> {};
struct PDiskType : Column<8, HostConfigDrive::TypeCol::ColumnType> { using Type = NKikimrBlobStorage::EPDiskType; };
struct PDiskConfig : Column<9, NScheme::NTypeIds::String> {};
+ struct Path : Column<10, NScheme::NTypeIds::String> {};
using TKey = TableKey<Serial>;
- using TColumns = TableColumns<Serial, BoxId, NodeId, PDiskId, Guid, LifeStage, Kind, PDiskType, PDiskConfig>;
+ using TColumns = TableColumns<Serial, BoxId, NodeId, PDiskId, Guid, LifeStage, Kind, PDiskType, PDiskConfig, Path>;
};
using TTables = SchemaTables<
diff --git a/ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_bs_controller_/flat_bs_controller.schema b/ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_bs_controller_/flat_bs_controller.schema
index dc3706617e..00cd34dd26 100644
--- a/ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_bs_controller_/flat_bs_controller.schema
+++ b/ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_bs_controller_/flat_bs_controller.schema
@@ -1415,6 +1415,11 @@
"ColumnId": 9,
"ColumnName": "PDiskConfig",
"ColumnType": "String"
+ },
+ {
+ "ColumnId": 10,
+ "ColumnName": "Path",
+ "ColumnType": "String"
}
],
"ColumnsDropped": [],
@@ -1429,7 +1434,8 @@
6,
7,
8,
- 9
+ 9,
+ 10
],
"RoomID": 0,
"Codec": 0,