From: Samuel Just Date: Thu, 1 Dec 2016 23:11:51 +0000 (-0800) Subject: ReplicatedPG::submit_log_entries: fill in repop->v X-Git-Tag: v11.1.0~58^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ef376c9793ea76165722d8929b700b236e78bdba;p=ceph.git ReplicatedPG::submit_log_entries: fill in repop->v This way, we can deal with waiting_for_commit appropriately. Also, add more debugging to new_repop and already_*. Signed-off-by: Samuel Just --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 7eaf2d2fb8f3..eb1762ec86d8 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -8649,10 +8649,12 @@ ReplicatedPG::RepGather *ReplicatedPG::new_repop( osd->logger->inc(l_osd_op_wip); + dout(10) << __func__ << ": " << *repop << dendl; return repop; } boost::intrusive_ptr ReplicatedPG::new_repop( + eversion_t version, ObcLockManager &&manager, OpRequestRef &&op, boost::optional > &&on_complete) @@ -8663,6 +8665,7 @@ boost::intrusive_ptr ReplicatedPG::new_repop( std::move(on_complete), osd->get_tid(), info.last_complete); + repop->v = version; repop->start = ceph_clock_now(cct); @@ -8670,6 +8673,7 @@ boost::intrusive_ptr ReplicatedPG::new_repop( osd->logger->inc(l_osd_op_wip); + dout(10) << __func__ << ": " << *repop << dendl; return boost::intrusive_ptr(repop); } @@ -8721,15 +8725,17 @@ void ReplicatedPG::submit_log_entries( dout(10) << __func__ << " " << entries << dendl; assert(is_primary()); + eversion_t version; if (!entries.empty()) { assert(entries.rbegin()->version >= projected_last_update); - projected_last_update = entries.rbegin()->version; + version = projected_last_update = entries.rbegin()->version; } boost::intrusive_ptr repop; boost::optional > on_complete; if (get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) { repop = new_repop( + version, std::move(manager), std::move(op), std::move(_on_complete)); @@ -12606,6 +12612,65 @@ void ReplicatedPG::agent_estimate_temp(const hobject_t& oid, int *temp) } } +// Dup op detection + +bool ReplicatedPG::already_complete(eversion_t v) +{ + dout(20) << __func__ << ": " << v << dendl; + for (xlist::iterator i = repop_queue.begin(); + !i.end(); + ++i) { + dout(20) << __func__ << ": " << **i << dendl; + // skip copy from temp object ops + if ((*i)->v == eversion_t()) { + dout(20) << __func__ << ": " << **i + << " version is empty" << dendl; + continue; + } + if ((*i)->v > v) { + dout(20) << __func__ << ": " << **i + << " (*i)->v past v" << dendl; + break; + } + if (!(*i)->all_committed) { + dout(20) << __func__ << ": " << **i + << " not committed, returning false" + << dendl; + return false; + } + } + dout(20) << __func__ << ": returning true" << dendl; + return true; +} + +bool ReplicatedPG::already_ack(eversion_t v) +{ + dout(20) << __func__ << ": " << v << dendl; + for (xlist::iterator i = repop_queue.begin(); + !i.end(); + ++i) { + // skip copy from temp object ops + if ((*i)->v == eversion_t()) { + dout(20) << __func__ << ": " << **i + << " version is empty" << dendl; + continue; + } + if ((*i)->v > v) { + dout(20) << __func__ << ": " << **i + << " (*i)->v past v" << dendl; + break; + } + if (!(*i)->all_applied) { + dout(20) << __func__ << ": " << **i + << " not applied, returning false" + << dendl; + return false; + } + } + dout(20) << __func__ << ": returning true" << dendl; + return true; +} + // ========================================================================================== // SCRUB diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index bb9fbf3fdcae..d56d4e8a9125 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -829,6 +829,7 @@ protected: ObjectContextRef obc, ceph_tid_t rep_tid); boost::intrusive_ptr new_repop( + eversion_t version, ObcLockManager &&manager, OpRequestRef &&op, boost::optional > &&on_complete); @@ -908,35 +909,9 @@ protected: void agent_choose_mode_restart() override; /// true if we can send an ondisk/commit for v - bool already_complete(eversion_t v) { - for (xlist::iterator i = repop_queue.begin(); - !i.end(); - ++i) { - // skip copy from temp object ops - if ((*i)->v == eversion_t()) - continue; - if ((*i)->v > v) - break; - if (!(*i)->all_committed) - return false; - } - return true; - } + bool already_complete(eversion_t v); /// true if we can send an ack for v - bool already_ack(eversion_t v) { - for (xlist::iterator i = repop_queue.begin(); - !i.end(); - ++i) { - // skip copy from temp object ops - if ((*i)->v == eversion_t()) - continue; - if ((*i)->v > v) - break; - if (!(*i)->all_applied) - return false; - } - return true; - } + bool already_ack(eversion_t v); // projected object info SharedLRU object_contexts;