Skip to content

Commit

Permalink
[NBS] fix false positive DiskRegistryNoScheduledNotification crit eve…
Browse files Browse the repository at this point in the history
…nt (#1798)
  • Loading branch information
sharpeye committed Aug 15, 2024
1 parent ec15673 commit 4de7ead
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,18 @@ void TDiskRegistryState::ProcessDisks(TVector<NProto::TDiskConfig> configs)
}

if (!config.GetFinishedMigrations().empty()) {
ui64 seqNo = NotificationSystem.GetDiskSeqNo(diskId);
const auto& notifiedDiskId = disk.MasterDiskId
? disk.MasterDiskId
: diskId;

ui64 seqNo = NotificationSystem.GetDiskSeqNo(notifiedDiskId);

if (!seqNo) {
ReportDiskRegistryNoScheduledNotification(TStringBuilder()
<< "No scheduled notification for disk " << diskId.Quote());
ReportDiskRegistryNoScheduledNotification(
TStringBuilder() << "No scheduled notification for disk "
<< notifiedDiskId.Quote());

seqNo = NotificationSystem.AddReallocateRequest(disk.MasterDiskId
? disk.MasterDiskId
: diskId);
seqNo = NotificationSystem.AddReallocateRequest(notifiedDiskId);
}

for (const auto& m: config.GetFinishedMigrations()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ Y_UNIT_TEST_SUITE(TDiskRegistryTest)
}
}

Y_UNIT_TEST(ShouldFinishMigrationForMirroredDisk)
void ShouldFinishMigrationForMirroredDiskImpl(bool rebootTable)
{
const auto agent1 = CreateAgentConfig("agent-1", {
Device("dev-1", "uuid-1", "rack-1", 10_GB),
Expand Down Expand Up @@ -359,6 +359,14 @@ Y_UNIT_TEST_SUITE(TDiskRegistryTest)

diskRegistry.FinishMigration("disk-1", "uuid-2", "uuid-6");

if (rebootTable) {
diskRegistry.RebootTablet();
diskRegistry.WaitReady();

RegisterAgents(*runtime, 3);
WaitForAgents(*runtime, 3);
}

{
auto response = diskRegistry.AllocateDisk(
"disk-1",
Expand Down Expand Up @@ -398,6 +406,16 @@ Y_UNIT_TEST_SUITE(TDiskRegistryTest)
UNIT_ASSERT_VALUES_EQUAL(0, msg.MigrationsSize());
}
}

Y_UNIT_TEST(ShouldFinishMigrationForMirroredDisk)
{
ShouldFinishMigrationForMirroredDiskImpl(false);
}

Y_UNIT_TEST(ShouldFinishMigrationForMirroredDiskAfterReboot)
{
ShouldFinishMigrationForMirroredDiskImpl(true);
}
}

} // namespace NCloud::NBlockStore::NStorage

0 comments on commit 4de7ead

Please sign in to comment.