-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 2404: mv WrongMigratedDeviceOwnership critical event to AddMigration Function #2955
base: main
Are you sure you want to change the base?
Issue 2404: mv WrongMigratedDeviceOwnership critical event to AddMigration Function #2955
Conversation
Hi! Thank you for contributing! |
if (agent.GetState() == NProto::AGENT_STATE_WARNING) { | ||
if (Find(disk.Devices, deviceId) == disk.Devices.end()) { | ||
ReportDiskRegistryWrongMigratedDeviceOwnership( | ||
TStringBuilder() << "ApplyAgentStateChange: device " | ||
<< deviceId << " not found"); | ||
continue; | ||
} | ||
|
||
if (MigrationCanBeStarted(disk, deviceId)) { | ||
AddMigration(disk, diskId, deviceId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не надо AddMigration менять. Достаточно перенести проверку MigrationCanBeStarted перед Find. И написать тест, который: создает диск, вызывает REMOVE_HOST (запускает миграцию), завершает миграцию, снова вызывает REMOVE_HOST - тут проверяем, что после фикса крит не тригерится
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я перенес Крит ивент в AddMigration, чтобы написать тест, который проверяет, что, если вдруг мы попытаемся запустить миграцию девайса не принадлежащую этому диску, мы зарепортим это событие. Что при попытке повторной миграции не будет Крит ивента, проверяется в тесте ShouldNotDuplicateMigrations.
nbs/cloud/blockstore/libs/storage/disk_registry/disk_registry_state_ut_migration.cpp
Lines 366 to 391 in d896cb0
NMonitoring::TDynamicCountersPtr counters = | |
new NMonitoring::TDynamicCounters(); | |
InitCriticalEventsCounter(counters); | |
auto configCounter = counters->GetCounter( | |
"AppCriticalEvents/DiskRegistryWrongMigratedDeviceOwnership", | |
true); | |
UNIT_ASSERT_VALUES_EQUAL(0, configCounter->Val()); | |
executor.WriteTx([&] (TDiskRegistryDatabase db) mutable { | |
auto affectedDisks = ChangeAgentState( | |
state, | |
db, | |
agents[0], | |
NProto::AGENT_STATE_WARNING); | |
UNIT_ASSERT_VALUES_EQUAL(0, affectedDisks.size()); | |
}); | |
{ | |
for (const auto& m: state.BuildMigrationList()) { | |
Cerr << "migration: " << m.DiskId << " " << m.SourceDeviceId << Endl; | |
} | |
} | |
UNIT_ASSERT(state.IsMigrationListEmpty()); | |
UNIT_ASSERT_VALUES_EQUAL(0, configCounter->Val()); |
#2404