From b44f49aab28d24cf03b1d1349629b50e061ffebf Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Thu, 12 Mar 2020 00:02:18 +0300 Subject: [PATCH] Ignore zero OSDs in history osd_sets --- mon/mon.js | 3 ++- src/osd_peering.cpp | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/mon/mon.js b/mon/mon.js index f1d0c129..7f85cc71 100644 --- a/mon/mon.js +++ b/mon/mon.js @@ -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 || []; diff --git a/src/osd_peering.cpp b/src/osd_peering.cpp index 4210c10f..64facb96 100644 --- a/src/osd_peering.cpp +++ b/src/osd_peering.cpp @@ -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)