Skip to content

Commit e1ad79a

Browse files
Set BSC LayoutCorrect default true (#16940)
1 parent 1167609 commit e1ad79a

File tree

2 files changed

+45
-28
lines changed

2 files changed

+45
-28
lines changed

ydb/core/health_check/health_check_ut.cpp

Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,7 +2219,7 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
22192219
TestConfigUpdateNodeRestartsPerPeriod(runtime, sender, nodeRestarts / 5, nodeRestarts / 2, nodeId, Ydb::Monitoring::StatusFlag::ORANGE);
22202220
}
22212221

2222-
Y_UNIT_TEST(LayoutIncorrect) {
2222+
void LayoutCorrectTest(bool layoutCorrect) {
22232223
TPortManager tp;
22242224
ui16 port = tp.GetPort(2134);
22252225
ui16 grpcPort = tp.GetPort(2135);
@@ -2241,13 +2241,11 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
22412241
auto* x = reinterpret_cast<NSysView::TEvSysView::TEvGetGroupsResponse::TPtr*>(&ev);
22422242
auto& record = (*x)->Get()->Record;
22432243
for (auto& entry : *record.mutable_entries()) {
2244-
entry.mutable_info()->set_layoutcorrect(false);
2244+
entry.mutable_info()->set_layoutcorrect(layoutCorrect);
22452245
}
2246-
22472246
break;
22482247
}
22492248
}
2250-
22512249
return TTestActorRuntime::EEventAction::PROCESS;
22522250
};
22532251
runtime.SetObserverFunc(observerFunc);
@@ -2258,32 +2256,51 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
22582256
runtime.Send(new IEventHandle(NHealthCheck::MakeHealthCheckID(), sender, request, 0));
22592257
auto result = runtime.GrabEdgeEvent<NHealthCheck::TEvSelfCheckResult>(handle)->Result;
22602258

2261-
UNIT_ASSERT_VALUES_EQUAL(result.self_check_result(), Ydb::Monitoring::SelfCheck::MAINTENANCE_REQUIRED);
2262-
UNIT_ASSERT_VALUES_EQUAL(result.database_status_size(), 1);
2263-
const auto &database_status = result.database_status(0);
2264-
2265-
UNIT_ASSERT_VALUES_EQUAL(database_status.overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2266-
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2267-
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools().size(), 1);
2268-
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2269-
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].groups().size(), 1);
2270-
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].groups()[0].overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2259+
if (layoutCorrect) {
2260+
UNIT_ASSERT_VALUES_EQUAL(result.self_check_result(), Ydb::Monitoring::SelfCheck::GOOD);
2261+
UNIT_ASSERT_VALUES_EQUAL(result.database_status_size(), 1);
2262+
const auto &database_status = result.database_status(0);
22712263

2272-
for (const auto &issue_log : result.issue_log()) {
2273-
if (issue_log.level() == 1 && issue_log.type() == "DATABASE") {
2274-
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().database().name(), "/Root");
2275-
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Database has storage issues");
2276-
} else if (issue_log.level() == 2 && issue_log.type() == "STORAGE") {
2277-
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().database().name(), "/Root");
2278-
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Storage has no redundancy");
2279-
} else if (issue_log.level() == 3 && issue_log.type() == "STORAGE_POOL") {
2280-
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().storage().pool().name(), "static");
2281-
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Pool has no redundancy");
2282-
} else if (issue_log.level() == 4 && issue_log.type() == "STORAGE_GROUP") {
2283-
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().storage().pool().name(), "static");
2284-
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Group layout is incorrect");
2264+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().overall(), Ydb::Monitoring::StatusFlag::GREEN);
2265+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools().size(), 1);
2266+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].overall(), Ydb::Monitoring::StatusFlag::GREEN);
2267+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].groups().size(), 1);
2268+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].groups()[0].overall(), Ydb::Monitoring::StatusFlag::GREEN);
2269+
} else {
2270+
UNIT_ASSERT_VALUES_EQUAL(result.self_check_result(), Ydb::Monitoring::SelfCheck::MAINTENANCE_REQUIRED);
2271+
UNIT_ASSERT_VALUES_EQUAL(result.database_status_size(), 1);
2272+
const auto &database_status = result.database_status(0);
2273+
2274+
UNIT_ASSERT_VALUES_EQUAL(database_status.overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2275+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2276+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools().size(), 1);
2277+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2278+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].groups().size(), 1);
2279+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].groups()[0].overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2280+
2281+
for (const auto &issue_log : result.issue_log()) {
2282+
if (issue_log.level() == 1 && issue_log.type() == "DATABASE") {
2283+
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().database().name(), "/Root");
2284+
} else if (issue_log.level() == 2 && issue_log.type() == "STORAGE") {
2285+
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().database().name(), "/Root");
2286+
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Storage has no redundancy");
2287+
} else if (issue_log.level() == 3 && issue_log.type() == "STORAGE_POOL") {
2288+
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().storage().pool().name(), "static");
2289+
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Pool has no redundancy");
2290+
} else if (issue_log.level() == 4 && issue_log.type() == "STORAGE_GROUP") {
2291+
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().storage().pool().name(), "static");
2292+
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Group layout is incorrect");
2293+
}
22852294
}
22862295
}
22872296
}
2297+
2298+
Y_UNIT_TEST(LayoutIncorrect) {
2299+
LayoutCorrectTest(false);
2300+
}
2301+
2302+
Y_UNIT_TEST(LayoutCorrect) {
2303+
LayoutCorrectTest(true);
2304+
}
22882305
}
22892306
}

ydb/core/protos/sys_view.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ message TGroupInfo {
277277
// desired disk categories ?
278278
// down/persisted down ?
279279
// metrics ?
280-
optional bool LayoutCorrect = 16; // is the group layout correct?
280+
optional bool LayoutCorrect = 16 [default = true]; // is the group layout correct?
281281
}
282282

283283
message TGroupEntry {

0 commit comments

Comments
 (0)