Ignore zero OSDs in history osd_sets

rel-0.5
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,
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].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)
for (auto & history_set: pg.target_history)
{
bool found = false;
bool found = true;
for (auto history_osd: history_set)
{
if (history_osd != 0 && (history_osd == this->osd_num ||
c_cli.osd_peer_fds.find(history_osd) != c_cli.osd_peer_fds.end()))
if (history_osd != 0)
{
found = true;
break;
found = false;
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)