From 3b5323d1491f7ebe83de243c325525488d496c32 Mon Sep 17 00:00:00 2001 From: Neha Ojha Date: Tue, 19 Dec 2017 13:18:25 -0800 Subject: [PATCH] PG: modify should_send_op to handle async recovery Signed-off-by: Neha Ojha --- src/osd/PrimaryLogPG.cc | 29 +++++++++++++++++++++++++++++ src/osd/PrimaryLogPG.h | 13 +------------ src/osd/ReplicatedBackend.cc | 5 ----- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 2fa81d49b65..8d3c709f674 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -525,6 +525,35 @@ void PrimaryLogPG::backfill_add_missing( missing_loc.add_missing(oid, v, eversion_t()); } +bool PrimaryLogPG::should_send_op( + pg_shard_t peer, + const hobject_t &hoid) { + if (peer == get_primary()) + return true; + assert(peer_info.count(peer)); + bool should_send = + hoid.pool != (int64_t)info.pgid.pool() || + hoid <= last_backfill_started || + hoid <= peer_info[peer].last_backfill; + if (!should_send) { + assert(is_backfill_targets(peer)); + dout(10) << __func__ << " issue_repop shipping empty opt to osd." << peer + << ", object " << hoid + << " beyond std::max(last_backfill_started " + << ", peer_info[peer].last_backfill " + << peer_info[peer].last_backfill << ")" << dendl; + return should_send; + } + if (async_recovery_targets.count(peer) && peer_missing[peer].is_missing(hoid)) { + should_send = false; + dout(10) << __func__ << " issue_repop shipping empty opt to osd." << peer + << ", object " << hoid + << " which is pending recovery in async_recovery_targets" << dendl; + } + return should_send; +} + + ConnectionRef PrimaryLogPG::get_con_osd_cluster( int peer, epoch_t from_epoch) { diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 3443185c865..2ef95a8c684 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -416,18 +416,7 @@ public: bool should_send_op( pg_shard_t peer, - const hobject_t &hoid) override { - if (peer == get_primary()) - return true; - assert(peer_info.count(peer)); - bool should_send = - hoid.pool != (int64_t)info.pgid.pool() || - hoid <= last_backfill_started || - hoid <= peer_info[peer].last_backfill; - if (!should_send) - assert(is_backfill_targets(peer)); - return should_send; - } + const hobject_t &hoid) override; bool pg_is_undersized() const override { return is_undersized(); diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 6ed7bbc61ad..43782872a6f 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -907,11 +907,6 @@ Message * ReplicatedBackend::generate_subop( // ship resulting transaction, log entries, and pg_stats if (!parent->should_send_op(peer, soid)) { - dout(10) << "issue_repop shipping empty opt to osd." << peer - <<", object " << soid - << " beyond std::max(last_backfill_started " - << ", pinfo.last_backfill " - << pinfo.last_backfill << ")" << dendl; ObjectStore::Transaction t; encode(t, wr->get_data()); } else { -- 2.39.5