Skip to content

Commit b3e1db3

Browse files
Set BSC LayoutCorrect default true (#16940) - merge stable-25-1 (#17059)
1 parent 5f3928d commit b3e1db3

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
@@ -2114,7 +2114,7 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
21142114
TestConfigUpdateNodeRestartsPerPeriod(runtime, sender, nodeRestarts / 5, nodeRestarts / 2, nodeId, Ydb::Monitoring::StatusFlag::ORANGE);
21152115
}
21162116

2117-
Y_UNIT_TEST(LayoutIncorrect) {
2117+
void LayoutCorrectTest(bool layoutCorrect) {
21182118
TPortManager tp;
21192119
ui16 port = tp.GetPort(2134);
21202120
ui16 grpcPort = tp.GetPort(2135);
@@ -2136,13 +2136,11 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
21362136
auto* x = reinterpret_cast<NSysView::TEvSysView::TEvGetGroupsResponse::TPtr*>(&ev);
21372137
auto& record = (*x)->Get()->Record;
21382138
for (auto& entry : *record.mutable_entries()) {
2139-
entry.mutable_info()->set_layoutcorrect(false);
2139+
entry.mutable_info()->set_layoutcorrect(layoutCorrect);
21402140
}
2141-
21422141
break;
21432142
}
21442143
}
2145-
21462144
return TTestActorRuntime::EEventAction::PROCESS;
21472145
};
21482146
runtime.SetObserverFunc(observerFunc);
@@ -2153,32 +2151,51 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
21532151
runtime.Send(new IEventHandle(NHealthCheck::MakeHealthCheckID(), sender, request, 0));
21542152
auto result = runtime.GrabEdgeEvent<NHealthCheck::TEvSelfCheckResult>(handle)->Result;
21552153

2156-
UNIT_ASSERT_VALUES_EQUAL(result.self_check_result(), Ydb::Monitoring::SelfCheck::MAINTENANCE_REQUIRED);
2157-
UNIT_ASSERT_VALUES_EQUAL(result.database_status_size(), 1);
2158-
const auto &database_status = result.database_status(0);
2159-
2160-
UNIT_ASSERT_VALUES_EQUAL(database_status.overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2161-
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2162-
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools().size(), 1);
2163-
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2164-
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].groups().size(), 1);
2165-
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].groups()[0].overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2154+
if (layoutCorrect) {
2155+
UNIT_ASSERT_VALUES_EQUAL(result.self_check_result(), Ydb::Monitoring::SelfCheck::GOOD);
2156+
UNIT_ASSERT_VALUES_EQUAL(result.database_status_size(), 1);
2157+
const auto &database_status = result.database_status(0);
21662158

2167-
for (const auto &issue_log : result.issue_log()) {
2168-
if (issue_log.level() == 1 && issue_log.type() == "DATABASE") {
2169-
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().database().name(), "/Root");
2170-
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Database has storage issues");
2171-
} else if (issue_log.level() == 2 && issue_log.type() == "STORAGE") {
2172-
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().database().name(), "/Root");
2173-
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Storage has no redundancy");
2174-
} else if (issue_log.level() == 3 && issue_log.type() == "STORAGE_POOL") {
2175-
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().storage().pool().name(), "static");
2176-
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Pool has no redundancy");
2177-
} else if (issue_log.level() == 4 && issue_log.type() == "STORAGE_GROUP") {
2178-
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().storage().pool().name(), "static");
2179-
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Group layout is incorrect");
2159+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().overall(), Ydb::Monitoring::StatusFlag::GREEN);
2160+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools().size(), 1);
2161+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].overall(), Ydb::Monitoring::StatusFlag::GREEN);
2162+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].groups().size(), 1);
2163+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].groups()[0].overall(), Ydb::Monitoring::StatusFlag::GREEN);
2164+
} else {
2165+
UNIT_ASSERT_VALUES_EQUAL(result.self_check_result(), Ydb::Monitoring::SelfCheck::MAINTENANCE_REQUIRED);
2166+
UNIT_ASSERT_VALUES_EQUAL(result.database_status_size(), 1);
2167+
const auto &database_status = result.database_status(0);
2168+
2169+
UNIT_ASSERT_VALUES_EQUAL(database_status.overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2170+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2171+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools().size(), 1);
2172+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2173+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].groups().size(), 1);
2174+
UNIT_ASSERT_VALUES_EQUAL(database_status.storage().pools()[0].groups()[0].overall(), Ydb::Monitoring::StatusFlag::ORANGE);
2175+
2176+
for (const auto &issue_log : result.issue_log()) {
2177+
if (issue_log.level() == 1 && issue_log.type() == "DATABASE") {
2178+
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().database().name(), "/Root");
2179+
} else if (issue_log.level() == 2 && issue_log.type() == "STORAGE") {
2180+
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().database().name(), "/Root");
2181+
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Storage has no redundancy");
2182+
} else if (issue_log.level() == 3 && issue_log.type() == "STORAGE_POOL") {
2183+
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().storage().pool().name(), "static");
2184+
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Pool has no redundancy");
2185+
} else if (issue_log.level() == 4 && issue_log.type() == "STORAGE_GROUP") {
2186+
UNIT_ASSERT_VALUES_EQUAL(issue_log.location().storage().pool().name(), "static");
2187+
UNIT_ASSERT_VALUES_EQUAL(issue_log.message(), "Group layout is incorrect");
2188+
}
21802189
}
21812190
}
21822191
}
2192+
2193+
Y_UNIT_TEST(LayoutIncorrect) {
2194+
LayoutCorrectTest(false);
2195+
}
2196+
2197+
Y_UNIT_TEST(LayoutCorrect) {
2198+
LayoutCorrectTest(true);
2199+
}
21832200
}
21842201
}

ydb/core/protos/sys_view.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ message TGroupInfo {
265265
// desired disk categories ?
266266
// down/persisted down ?
267267
// metrics ?
268-
optional bool LayoutCorrect = 16; // is the group layout correct?
268+
optional bool LayoutCorrect = 16 [default = true]; // is the group layout correct?
269269
}
270270

271271
message TGroupEntry {

0 commit comments

Comments
 (0)