From 1f2274e2b4b62a3258c3e155949bea6fba2c7858 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 23 Sep 2015 10:14:47 -0400 Subject: [PATCH] osd/PG: set last_epoch_marked_full on map advance This will get persisted and shared. Signed-off-by: Sage Weil --- src/osd/PG.cc | 26 ++++++++++++++++++++++++++ src/osd/PG.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index f217eb1faa643..79cd54a1c3602 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -4484,6 +4484,29 @@ bool PG::may_need_replay(const OSDMapRef osdmap) const return crashed; } +void PG::check_full_transition(OSDMapRef lastmap, OSDMapRef osdmap) +{ + bool changed = false; + if (osdmap->test_flag(CEPH_OSDMAP_FULL) && + !lastmap->test_flag(CEPH_OSDMAP_FULL)) { + dout(10) << " cluster was marked full in " << osdmap->get_epoch() << dendl; + changed = true; + } + const pg_pool_t *pi = osdmap->get_pg_pool(info.pgid.pool()); + assert(pi); + if (pi->has_flag(pg_pool_t::FLAG_FULL)) { + const pg_pool_t *opi = lastmap->get_pg_pool(info.pgid.pool()); + if (!opi || !opi->has_flag(pg_pool_t::FLAG_FULL)) { + dout(10) << " pool was marked full in " << osdmap->get_epoch() << dendl; + changed = true; + } + } + if (changed) { + info.history.last_epoch_marked_full = osdmap->get_epoch(); + dirty_info = true; + } +} + bool PG::should_restart_peering( int newupprimary, int newactingprimary, @@ -5378,6 +5401,7 @@ boost::statechart::result PG::RecoveryState::Started::react(const AdvMap& advmap { dout(10) << "Started advmap" << dendl; PG *pg = context< RecoveryMachine >().pg; + pg->check_full_transition(advmap.lastmap, advmap.osdmap); if (pg->should_restart_peering( advmap.up_primary, advmap.acting_primary, @@ -5447,6 +5471,8 @@ boost::statechart::result PG::RecoveryState::Reset::react(const AdvMap& advmap) // _before_ we are active. pg->generate_past_intervals(); + pg->check_full_transition(advmap.lastmap, advmap.osdmap); + if (pg->should_restart_peering( advmap.up_primary, advmap.acting_primary, diff --git a/src/osd/PG.h b/src/osd/PG.h index 7859f1a5a3c0d..a7dfa403451fd 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2228,6 +2228,8 @@ public: pair ¬ify_info); void fulfill_log(pg_shard_t from, const pg_query_t &query, epoch_t query_epoch); + void check_full_transition(OSDMapRef lastmap, OSDMapRef osdmap); + bool should_restart_peering( int newupprimary, int newactingprimary, -- 2.39.5