From a8ad5090381ced2f7ba2465dd0c1ae08b743d36d Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Fri, 13 Dec 2019 13:28:09 -0800 Subject: [PATCH] osd/: maintain PeeringState::min_last_complete_ondisk on replica Signed-off-by: Samuel Just --- src/osd/ECBackend.cc | 1 + src/osd/PGBackend.h | 1 + src/osd/PeeringState.cc | 12 ++++++++---- src/osd/PeeringState.h | 1 + src/osd/PrimaryLogPG.h | 4 +++- src/osd/ReplicatedBackend.cc | 4 +++- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index 27c3dd03223f0..9b46de4af6313 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -960,6 +960,7 @@ void ECBackend::handle_sub_write( op.updated_hit_set_history, op.trim_to, op.roll_forward_to, + op.roll_forward_to, !op.backfill_or_async_recovery, localt, async); diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index 1b4c48fd48ceb..734d857bf28c2 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -235,6 +235,7 @@ typedef std::shared_ptr OSDMapRef; const std::optional &hset_history, const eversion_t &trim_to, const eversion_t &roll_forward_to, + const eversion_t &min_last_complete_ondisk, bool transaction_applied, ObjectStore::Transaction &t, bool async = false) = 0; diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 2d3450646cb40..af57ce1b29064 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -2334,9 +2334,9 @@ void PeeringState::activate( auto &missing = pg_log.get_missing(); + min_last_complete_ondisk = eversion_t(0,0); // we don't know (yet)! if (is_primary()) { 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(); @@ -3773,6 +3773,7 @@ void PeeringState::append_log( const vector& logv, eversion_t trim_to, eversion_t roll_forward_to, + eversion_t mlcod, ObjectStore::Transaction &t, bool transaction_applied, bool async) @@ -3836,6 +3837,9 @@ void PeeringState::append_log( // update the local pg, pg log dirty_info = true; write_if_dirty(t); + + if (!is_primary()) + min_last_complete_ondisk = mlcod; } void PeeringState::recover_got( @@ -6052,6 +6056,8 @@ void PeeringState::ReplicaActive::exit() pl->cancel_remote_recovery_reservation(); utime_t dur = ceph_clock_now() - enter_time; pl->get_peering_perf().tinc(rs_replicaactive_latency, dur); + + ps->min_last_complete_ondisk = eversion_t(); } /*-------Stray---*/ @@ -7004,9 +7010,7 @@ ostream &operator<<(ostream &out, const PeeringState &ps) { if (ps.last_complete_ondisk != ps.info.last_complete) out << " lcod " << ps.last_complete_ondisk; - if (ps.is_primary()) { - out << " mlcod " << ps.min_last_complete_ondisk; - } + out << " mlcod " << ps.min_last_complete_ondisk; out << " " << pg_state_string(ps.get_state()); if (ps.should_send_notify()) diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index cb8d08b2362cf..c67a76881fdc4 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -1770,6 +1770,7 @@ public: const vector& logv, eversion_t trim_to, eversion_t roll_forward_to, + eversion_t min_last_complete_ondisk, ObjectStore::Transaction &t, bool transaction_applied, bool async); diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 150ac08f26343..4ca01b2f61ebe 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -459,6 +459,7 @@ public: const std::optional &hset_history, const eversion_t &trim_to, const eversion_t &roll_forward_to, + const eversion_t &min_last_complete_ondisk, bool transaction_applied, ObjectStore::Transaction &t, bool async = false) override { @@ -474,7 +475,8 @@ public: projected_log.trim(cct, last->version, nullptr, nullptr, nullptr); } recovery_state.append_log( - logv, trim_to, roll_forward_to, t, transaction_applied, async); + logv, trim_to, roll_forward_to, min_last_complete_ondisk, + t, transaction_applied, async); } void op_applied(const eversion_t &applied_version) override; diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 2f82da28b9977..78effa9048283 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -450,7 +450,7 @@ void ReplicatedBackend::submit_transaction( const eversion_t &at_version, PGTransactionUPtr &&_t, const eversion_t &trim_to, - const eversion_t &roll_forward_to, + const eversion_t &min_last_complete_ondisk, const vector &_log_entries, std::optional &hset_history, Context *on_all_commit, @@ -514,6 +514,7 @@ void ReplicatedBackend::submit_transaction( hset_history, trim_to, at_version, + min_last_complete_ondisk, true, op_t); @@ -1111,6 +1112,7 @@ void ReplicatedBackend::do_repop(OpRequestRef op) m->updated_hit_set_history, m->pg_trim_to, m->version, /* Replicated PGs don't have rollback info */ + m->min_last_complete_ondisk, update_snaps, rm->localt, async); -- 2.39.5