From: Neha Ojha Date: Fri, 26 Jan 2018 18:36:21 +0000 (-0800) Subject: PG: update pg_log missing for async_recovery_targets X-Git-Tag: v13.1.0~548^2~15 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=fa01affde135c66d04ad7b7c0248eee634526798;p=ceph.git PG: update pg_log missing for async_recovery_targets Signed-off-by: Neha Ojha --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index f9b291145f742..e82d250e00a49 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -458,7 +458,9 @@ void PG::proc_replica_log( dout(20) << " after missing " << i->first << " need " << i->second.need << " have " << i->second.have << dendl; } + dout(10) << __func__ << " peer_missing " << peer_missing[from].get_items() << dendl; peer_missing[from].claim(omissing); + dout(10) << __func__ << " peer_missing after claim" << peer_missing[from].get_items() << dendl; } bool PG::proc_replica_info( diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index 26fda688e8ee3..c0581f5cae2dd 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -166,6 +166,7 @@ typedef ceph::shared_ptr OSDMapRef; const = 0; virtual const pg_missing_tracker_t &get_local_missing() const = 0; + virtual void add_local_next_event(const pg_log_entry_t& e) = 0; virtual const map &get_shard_missing() const = 0; virtual boost::optional maybe_get_shard_missing( diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 1b889ee0aaea2..f238c0579bf15 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -663,8 +663,12 @@ public: const pg_missing_tracker_t& get_missing() const { return missing; } - void missing_add(const hobject_t& oid, eversion_t need, eversion_t have) { - missing.add(oid, need, have, false); + void missing_add(const hobject_t& oid, eversion_t need, eversion_t have, bool is_delete=false) { + missing.add(oid, need, have, is_delete); + } + + void missing_add_next_entry(const pg_log_entry_t& e) { + missing.add_next_event(e); } //////////////////// get or set log //////////////////// diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index cd4285a63fb1a..9310d137b7cd8 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -10067,6 +10067,11 @@ void PrimaryLogPG::issue_repop(RepGather *repop, OpContext *ctx) projected_log.add(entry); } + for (map::iterator i = peer_missing.begin(); + i != peer_missing.end(); + ++i) { + dout(10) << __func__ << " shard " << i->first << " before missing " << (i->second).get_items() << dendl; + } for (set::iterator i = async_recovery_targets.begin(); i != async_recovery_targets.end(); ++i) { @@ -10076,6 +10081,12 @@ void PrimaryLogPG::issue_repop(RepGather *repop, OpContext *ctx) } } + for (map::iterator i = peer_missing.begin(); + i != peer_missing.end(); + ++i) { + dout(10) << __func__ << " shard " << i->first << " after add next missing " << (i->second).get_items() << dendl; + } + for (set::const_iterator i = acting_recovery_backfill.begin(); i != acting_recovery_backfill.end(); ++i) { diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 5d36a3b616a4f..2b007058aaf28 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -355,6 +355,9 @@ public: const PGLog &get_log() const override { return pg_log; } + void add_local_next_event(const pg_log_entry_t& e) { + pg_log.missing_add_next_entry(e); + } bool pgb_is_primary() const override { return is_primary(); } diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index b9b31bc46d879..91a76f77108a6 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -1004,6 +1004,7 @@ void ReplicatedBackend::do_repop(OpRequestRef op) // sanity checks assert(m->map_epoch >= get_info().history.same_interval_since); + dout(10) << __func__ << " missing before " << get_parent()->get_log().get_missing().get_items() << dendl; parent->maybe_preempt_replica_scrub(soid); int ackerosd = m->get_source().num(); @@ -1049,6 +1050,19 @@ void ReplicatedBackend::do_repop(OpRequestRef op) // collections now. Otherwise, we do it later on push. update_snaps = true; } + + pg_missing_tracker_t pmissing = get_parent()->get_local_missing(); + if (pmissing.is_missing(soid)) { + dout(10) << __func__ << " j->second.is_missing(soid) " << pmissing.is_missing(soid) << dendl; + for (auto &&e: log) { + dout(10) << " add_next_event entry " << e << dendl; + get_parent()->add_local_next_event(e); + dout(10) << " entry version " << e.version << dendl; + dout(10) << " entry prior version " << e.prior_version << dendl; + dout(10) << " entry is_delete " << e.is_delete() << dendl; + } + } + parent->update_stats(m->pg_stats); parent->log_operation( log, @@ -1067,6 +1081,7 @@ void ReplicatedBackend::do_repop(OpRequestRef op) tls.push_back(std::move(rm->opt)); parent->queue_transactions(tls, op); // op is cleaned up by oncommit/onapply when both are executed + dout(10) << __func__ << " missing after" << get_parent()->get_log().get_missing().get_items() << dendl; } void ReplicatedBackend::repop_commit(RepModifyRef rm)