From 6da45c30ddee965be92eefa7d68cfb8fd5be25bb Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 16 Mar 2018 14:02:49 -0500 Subject: [PATCH] Revert "osd/PG: remove last_updated_applied, op_applied()" This reverts commit c1c495f09754986772c28c9cc7414609572a385c. Signed-off-by: Sage Weil --- src/osd/PG.cc | 4 +++- src/osd/PG.h | 1 + src/osd/PrimaryLogPG.cc | 10 ++++++++++ src/osd/PrimaryLogPG.h | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 175bd755dc42a..86d958b4799ed 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1615,6 +1615,7 @@ void PG::activate(ObjectStore::Transaction& t, last_update_ondisk = info.last_update; min_last_complete_ondisk = eversion_t(0,0); // we don't know (yet)! } + last_update_applied = info.last_update; last_rollback_info_trimmed_to_applied = pg_log.get_can_rollback_to(); need_up_thru = false; @@ -4353,7 +4354,8 @@ void PG::repair_object( /* replica_scrub * - * Wait for pushes to complete in case of recent recovery. Build a single + * Wait for last_update_applied to match msg->scrub_to as above. Wait + * for pushes to complete in case of recent recovery. Build a single * scrubmap of objects that are in the range [msg->start, msg->end). */ void PG::replica_scrub( diff --git a/src/osd/PG.h b/src/osd/PG.h index a167e75bbe0f6..e275f3bd8fa5f 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -827,6 +827,7 @@ protected: protected: eversion_t last_update_ondisk; // last_update that has committed; ONLY DEFINED WHEN is_active() eversion_t last_complete_ondisk; // last_complete that has committed. + eversion_t last_update_applied; // entries <= last_rollback_info_trimmed_to_applied have been trimmed eversion_t last_rollback_info_trimmed_to_applied; diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index dc194e0372998..b5ac56aa28f6e 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -9927,6 +9927,13 @@ void PrimaryLogPG::repop_all_committed(RepGather *repop) } } +void PrimaryLogPG::op_applied(const eversion_t &applied_version) +{ + dout(10) << "op_applied version " << applied_version << dendl; + assert(applied_version <= info.last_update); + last_update_applied = applied_version; +} + void PrimaryLogPG::eval_repop(RepGather *repop) { const MOSDOp *m = NULL; @@ -10033,6 +10040,7 @@ void PrimaryLogPG::issue_repop(RepGather *repop, OpContext *ctx) repop->rep_tid, ctx->reqid, ctx->op); + op_applied(ctx->at_version); } PrimaryLogPG::RepGather *PrimaryLogPG::new_repop( @@ -10227,6 +10235,7 @@ void PrimaryLogPG::submit_log_entries( new OnComplete{this, rep_tid, get_osdmap()->get_epoch()}); int r = osd->store->queue_transaction(ch, std::move(t), NULL); assert(r == 0); + op_applied(info.last_update); }); } @@ -11202,6 +11211,7 @@ void PrimaryLogPG::do_update_log_missing(OpRequestRef &op) std::move(t), nullptr); assert(tr == 0); + op_applied(info.last_update); } void PrimaryLogPG::do_update_log_missing_reply(OpRequestRef &op) diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 90713db5365b4..d46af22543c67 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -414,6 +414,8 @@ public: append_log(logv, trim_to, roll_forward_to, t, transaction_applied); } + void op_applied(const eversion_t &applied_version); // remove me + bool should_send_op( pg_shard_t peer, const hobject_t &hoid) override { -- 2.39.5