Do not start EC PGs without at least pg_data_size connections to old OSDs from each set

This commit is contained in:
Vitaliy Filippov
2023-06-17 02:16:30 +03:00
parent affe8fc270
commit aa5dacc7a9
+4 -5
View File
@@ -240,21 +240,20 @@ void osd_t::start_pg_peering(pg_t & pg)
// (PG history is kept up to the latest active+clean state) // (PG history is kept up to the latest active+clean state)
for (auto & history_set: pg.target_history) for (auto & history_set: pg.target_history)
{ {
bool found = true; int nonzero = 0, found = 0;
for (auto history_osd: history_set) for (auto history_osd: history_set)
{ {
if (history_osd != 0) if (history_osd != 0)
{ {
found = false; nonzero++;
if (history_osd == this->osd_num || if (history_osd == this->osd_num ||
msgr.osd_peer_fds.find(history_osd) != msgr.osd_peer_fds.end()) msgr.osd_peer_fds.find(history_osd) != msgr.osd_peer_fds.end())
{ {
found = true; found++;
break;
} }
} }
} }
if (!found) if (found < (nonzero >= pg.pg_data_size ? pg.pg_data_size : 1))
{ {
pg.state = PG_INCOMPLETE; pg.state = PG_INCOMPLETE;
report_pg_state(pg); report_pg_state(pg);