]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/PG: distinct down state instead of down+peering
authorSage Weil <sage@redhat.com>
Fri, 2 Dec 2016 21:02:02 +0000 (16:02 -0500)
committerSage Weil <sage@redhat.com>
Fri, 2 Dec 2016 21:16:18 +0000 (16:16 -0500)
When we declare a PG down, move to a distinct down state
(!= down+peering) so that we know peering completed (and
concluded the PG is down).

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h
src/osd/PG.cc
src/osd/PG.h

index d6db61b13dc6f770e06b8e10c33ba95b04ccfa44..799cc4a9f2f94f3dc2ffdfd83ddd5fd8edda0226 100644 (file)
@@ -2648,6 +2648,7 @@ void OSD::create_recoverystate_perf()
   rs_perf.add_time_avg(rs_getlog_latency, "getlog_latency", "Getlog recovery state latency");
   rs_perf.add_time_avg(rs_waitactingchange_latency, "waitactingchange_latency", "Waitactingchange recovery state latency");
   rs_perf.add_time_avg(rs_incomplete_latency, "incomplete_latency", "Incomplete recovery state latency");
+  rs_perf.add_time_avg(rs_down_latency, "down_latency", "Down recovery state latency");
   rs_perf.add_time_avg(rs_getmissing_latency, "getmissing_latency", "Getmissing recovery state latency");
   rs_perf.add_time_avg(rs_waitupthru_latency, "waitupthru_latency", "Waitupthru recovery state latency");
 
index 349fcaeec2f58ebe7a2767f92eb24d13edd6a177..edf0b2a10db23f4f4591cdc37d5ba75ca290033a 100644 (file)
@@ -195,6 +195,7 @@ enum {
   rs_getlog_latency,
   rs_waitactingchange_latency,
   rs_incomplete_latency,
+  rs_down_latency,
   rs_getmissing_latency,
   rs_waitupthru_latency,
   rs_last,
index 6daf383cbc25adcd9d889f65de825434845ffd96..458cddde9a51e0dfbd6f27f11dec8520fbc4ab8a 100644 (file)
@@ -7247,7 +7247,9 @@ PG::RecoveryState::GetInfo::GetInfo(my_context ctx)
 
   pg->reset_min_peer_features();
   get_infos();
-  if (peer_info_requested.empty() && !prior_set->pg_down) {
+  if (prior_set->pg_down) {
+    post_event(IsDown());
+  } else if (peer_info_requested.empty()) {
     post_event(GotInfo());
   }
 }
@@ -7377,8 +7379,7 @@ boost::statechart::result PG::RecoveryState::GetInfo::react(const MNotifyRec& in
          }
          if (!any_up_complete_now && any_down_now) {
            dout(10) << " no osds up+complete from interval " << interval << dendl;
-           pg->state_set(PG_STATE_DOWN);
-            pg->publish_stats_to_osd();
+           post_event(IsDown());
            return discard_event();
          }
          break;
@@ -7621,6 +7622,36 @@ void PG::RecoveryState::WaitActingChange::exit()
   pg->osd->recoverystate_perf->tinc(rs_waitactingchange_latency, dur);
 }
 
+/*------Down--------*/
+PG::RecoveryState::Down::Down(my_context ctx)
+  : my_base(ctx),
+    NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Peering/Down")
+{
+  context< RecoveryMachine >().log_enter(state_name);
+  PG *pg = context< RecoveryMachine >().pg;
+
+  pg->state_clear(PG_STATE_PEERING);
+  pg->state_set(PG_STATE_DOWN);
+
+  unique_ptr<PriorSet> &prior_set = context< Peering >().prior_set;
+  assert(pg->blocked_by.empty());
+  pg->blocked_by.insert(prior_set->down.begin(), prior_set->down.end());
+  pg->publish_stats_to_osd();
+}
+
+void PG::RecoveryState::Down::exit()
+{
+  context< RecoveryMachine >().log_exit(state_name, enter_time);
+  PG *pg = context< RecoveryMachine >().pg;
+
+  pg->state_clear(PG_STATE_DOWN);
+  utime_t dur = ceph_clock_now(pg->cct) - enter_time;
+  pg->osd->recoverystate_perf->tinc(rs_down_latency, dur);
+
+  pg->blocked_by.clear();
+  pg->publish_stats_to_osd();
+}
+
 /*------Incomplete--------*/
 PG::RecoveryState::Incomplete::Incomplete(my_context ctx)
   : my_base(ctx),
index 9a61cf493137f6348863103bf693ae1d30fc7ec0..41c610980fb0861fa077afe5a50fe421b221e7c2 100644 (file)
@@ -1643,6 +1643,10 @@ public:
     struct IsIncomplete : boost::statechart::event< IsIncomplete > {
       IsIncomplete() : boost::statechart::event< IsIncomplete >() {}
     };
+    struct Down;
+    struct IsDown : boost::statechart::event< IsDown > {
+      IsDown() : boost::statechart::event< IsDown >() {}
+    };
 
     struct Primary : boost::statechart::state< Primary, Started, Peering >, NamedState {
       explicit Primary(my_context ctx);
@@ -1928,7 +1932,8 @@ public:
       typedef boost::mpl::list <
        boost::statechart::custom_reaction< QueryState >,
        boost::statechart::transition< GotInfo, GetLog >,
-       boost::statechart::custom_reaction< MNotifyRec >
+       boost::statechart::custom_reaction< MNotifyRec >,
+       boost::statechart::transition< IsDown, Down >
        > reactions;
       boost::statechart::result react(const QueryState& q);
       boost::statechart::result react(const MNotifyRec& infoevt);
@@ -1989,6 +1994,11 @@ public:
       boost::statechart::result react(const MLogRec& logrec);
     };
 
+    struct Down : boost::statechart::state< Down, Peering>, NamedState {
+      explicit Down(my_context ctx);
+      void exit();
+    };
+
     struct Incomplete : boost::statechart::state< Incomplete, Peering>, NamedState {
       typedef boost::mpl::list <
        boost::statechart::custom_reaction< AdvMap >,