Skip to content

Commit

Permalink
issue-2715: correct issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vladstepanyuk committed Dec 18, 2024
1 parent 59824e9 commit ed23677
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5034,7 +5034,8 @@ void TDiskRegistryState::ApplyAgentStateChange(

if (Find(disk.Devices, deviceId) == disk.Devices.end()) {
ReportDiskRegistryWrongMigratedDeviceOwnership(
TStringBuilder() << "device " << deviceId << " not found");
TStringBuilder() << __PRETTY_FUNCTION__ << ": device "
<< deviceId << " not found");
continue;
}

Expand Down Expand Up @@ -6136,11 +6137,10 @@ NProto::TError TDiskRegistryState::FinishDeviceMigration(
auto devIt = Find(disk.Devices, sourceId);

if (devIt == disk.Devices.end()) {
ReportDiskRegistryWrongMigratedDeviceOwnership(
TStringBuilder() << "device " << sourceId.Quote() << " not found");
return MakeError(
E_INVALID_STATE,
TStringBuilder() << "device " << sourceId.Quote() << " not found");
auto message = ReportDiskRegistryWrongMigratedDeviceOwnership(
TStringBuilder() << __PRETTY_FUNCTION__ << ": device "
<< sourceId.Quote() << " not found");
return MakeError(E_INVALID_STATE, std::move(message));
}

if (auto it = disk.MigrationTarget2Source.find(targetId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ Y_UNIT_TEST_SUITE(TDiskRegistryStateMigrationTest)
auto configCounter = counters->GetCounter(
"AppCriticalEvents/DiskRegistryWrongMigratedDeviceOwnership",
true);
UNIT_ASSERT_VALUES_EQUAL(0, static_cast<int>(*configCounter));
UNIT_ASSERT_VALUES_EQUAL(0, configCounter->Val());

executor.WriteTx([&] (TDiskRegistryDatabase db) mutable {
auto affectedDisks = ChangeAgentState(
Expand All @@ -341,7 +341,7 @@ Y_UNIT_TEST_SUITE(TDiskRegistryStateMigrationTest)
UNIT_ASSERT(state.IsMigrationListEmpty());
// Now bug is fixed, but, if it reproduce in future, we must report
// event.
UNIT_ASSERT_VALUES_EQUAL(1, static_cast<int>(*configCounter));
UNIT_ASSERT_VALUES_EQUAL(1, configCounter->Val());
}

Y_UNIT_TEST(ShouldEraseMigrationsForDeletedDisk)
Expand Down

0 comments on commit ed23677

Please sign in to comment.