Skip to content

Commit c898c80

Browse files
author
yuryalekseev
committed
Fix loading of data from DrivesSerials #2.
1 parent fc7cc9d commit c898c80

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

ydb/core/mind/bscontroller/load_everything.cpp

+7-8
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,11 @@ class TBlobStorageController::TTxLoadEverything : public TTransactionBase<TBlobS
261261
}
262262
}
263263

264-
for (const auto& [serial, info] : Self->DrivesSerials) {
265-
if (info->NodeId && info->PDiskId && info->LifeStage == NKikimrBlobStorage::TDriveLifeStage::ADDED_BY_DSTOOL) {
266-
const bool inserted = driveToBox.emplace(std::make_tuple(*info->NodeId, serial.Serial), info->BoxId).second;
267-
Y_VERIFY(inserted, "duplicate Serial-generated drive");
264+
for (const auto& [_, info] : Self->DrivesSerials) {
265+
if (info->LifeStage == NKikimrBlobStorage::TDriveLifeStage::ADDED_BY_DSTOOL) {
266+
Y_VERIFY(info->NodeId);
267+
Y_VERIFY(info->Path);
268+
driveToBox.emplace(std::make_tuple(*info->NodeId, *info->Path), info->BoxId);
268269
}
269270
}
270271

@@ -288,9 +289,7 @@ class TBlobStorageController::TTxLoadEverything : public TTransactionBase<TBlobS
288289
THostId hostId;
289290
TBoxId boxId;
290291
TString path = disks.GetValue<T::Path>();
291-
TString pathOrSerial = path ? path : disks.GetValue<T::ExpectedSerial>();
292-
Y_VERIFY_S(pathOrSerial, "For pdiskId# " << disks.GetValue<T::PDiskID>()
293-
<< " not found neither pathOrSerial nor serial");
292+
Y_VERIFY_S(path, "Couldn't find path for pdiskId# " << disks.GetValue<T::PDiskID>());
294293

295294
if (const auto& x = Self->HostRecords->GetHostId(disks.GetValue<T::NodeID>())) {
296295
hostId = *x;
@@ -299,7 +298,7 @@ class TBlobStorageController::TTxLoadEverything : public TTransactionBase<TBlobS
299298
}
300299

301300
// find the owning box
302-
if (const auto it = driveToBox.find(std::make_tuple(disks.GetValue<T::NodeID>(), pathOrSerial)); it != driveToBox.end()) {
301+
if (const auto it = driveToBox.find(std::make_tuple(disks.GetValue<T::NodeID>(), path)); it != driveToBox.end()) {
303302
boxId = it->second;
304303
driveToBox.erase(it);
305304
} else {

0 commit comments

Comments
 (0)