Ignore zero OSDs in history osd_sets

pull/5/head
Vitaliy Filippov 2020-03-12 00:02:18 +03:00
parent 036555638e
commit b44f49aab2
2 changed files with 11 additions and 6 deletions

View File

@ -655,7 +655,8 @@ class Mon
osd_set, osd_set,
primary: alive_set.length ? alive_set[Math.floor(Math.random()*alive_set.length)] : 0, primary: alive_set.length ? alive_set[Math.floor(Math.random()*alive_set.length)] : 0,
}; };
if (prev_pgs[i] && prev_pgs[i].join(' ') != osd_set.join(' ')) if (prev_pgs[i] && prev_pgs[i].join(' ') != osd_set.join(' ') &&
prev_pgs[i].filter(osd_num => osd_num).length > 0)
{ {
pg_history[i] = pg_history[i] || {}; pg_history[i] = pg_history[i] || {};
pg_history[i].osd_sets = pg_history[i].osd_sets || []; pg_history[i].osd_sets = pg_history[i].osd_sets || [];

View File

@ -180,14 +180,18 @@ 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 = false; bool found = true;
for (auto history_osd: history_set) for (auto history_osd: history_set)
{ {
if (history_osd != 0 && (history_osd == this->osd_num || if (history_osd != 0)
c_cli.osd_peer_fds.find(history_osd) != c_cli.osd_peer_fds.end()))
{ {
found = true; found = false;
break; if (history_osd == this->osd_num ||
c_cli.osd_peer_fds.find(history_osd) != c_cli.osd_peer_fds.end())
{
found = true;
break;
}
} }
} }
if (!found) if (!found)