From 8dc1ffb13b130128d924bf2809aae041b2c7d3f6 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sun, 23 Jan 2022 19:15:10 +0300 Subject: [PATCH] Try to connect with PG peers before deciding it's incomplete :) I already attempted to fix it in 0.6.11, but it happened so that the fix was only partial :) --- src/osd_peering.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/osd_peering.cpp b/src/osd_peering.cpp index ef8ee53b..69bd002c 100644 --- a/src/osd_peering.cpp +++ b/src/osd_peering.cpp @@ -176,6 +176,17 @@ void osd_t::start_pg_peering(pg_t & pg) msgr.stop_client(peer_fd); } } + // Try to connect with current peers if they're up, but we don't have connections to them + // Otherwise we may erroneously decide that the pg is incomplete :-) + for (auto pg_osd: pg.all_peers) + { + if (pg_osd != this->osd_num && + msgr.osd_peer_fds.find(pg_osd) == msgr.osd_peer_fds.end() && + msgr.wanted_peers.find(pg_osd) == msgr.wanted_peers.end()) + { + msgr.connect_peer(pg_osd, st_cli.peer_states[pg_osd]); + } + } // Calculate current write OSD set pg.pg_cursize = 0; pg.cur_set.resize(pg.target_set.size()); @@ -207,10 +218,6 @@ void osd_t::start_pg_peering(pg_t & pg) { cur_peers.insert(pg_osd); } - else if (msgr.wanted_peers.find(pg_osd) == msgr.wanted_peers.end()) - { - msgr.connect_peer(pg_osd, st_cli.peer_states[pg_osd]); - } } if (pg.target_history.size()) {