Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

vladstepanyuk
Copy link
Contributor

@vladstepanyuk vladstepanyuk commented Jan 31, 2025

Copy link
Contributor

Hi! Thank you for contributing!
The tests on this PR will run after a maintainer adds an ok-to-test label to this PR manually. Thank you for your patience!

@komarevtsev-d komarevtsev-d added blockstore Add this label to run only cloud/blockstore build and tests on PR large-tests Launch large tests for PR ok-to-test Label to approve test launch for external members labels Jan 31, 2025
@github-actions github-actions bot removed the ok-to-test Label to approve test launch for external members label Jan 31, 2025
Copy link
Contributor

Note

This is an automated comment that will be appended during run.

🔴 linux-x86_64-relwithdebinfo: some tests FAILED for commit 3714943.

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
3803 3802 0 1 0 0

@komarevtsev-d komarevtsev-d added the ok-to-test Label to approve test launch for external members label Jan 31, 2025
@github-actions github-actions bot removed the ok-to-test Label to approve test launch for external members label Jan 31, 2025
Comment on lines 5046 to -5034
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);
Copy link
Collaborator

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 - тут проверяем, что после фикса крит не тригерится

Copy link
Contributor Author

@vladstepanyuk vladstepanyuk Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я перенес Крит ивент в AddMigration, чтобы написать тест, который проверяет, что, если вдруг мы попытаемся запустить миграцию девайса не принадлежащую этому диску, мы зарепортим это событие. Что при попытке повторной миграции не будет Крит ивента, проверяется в тесте ShouldNotDuplicateMigrations.

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());

Copy link
Contributor

Note

This is an automated comment that will be appended during run.

🟢 linux-x86_64-relwithdebinfo: all tests PASSED for commit d896cb0.

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
3803 3803 0 0 0 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blockstore Add this label to run only cloud/blockstore build and tests on PR large-tests Launch large tests for PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants