]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: replace is_split, acting_up_affected with should_restart_peering
authorSamuel Just <sam.just@inktank.com>
Wed, 7 May 2014 18:03:15 +0000 (11:03 -0700)
committerSamuel Just <sam.just@inktank.com>
Wed, 14 May 2014 20:17:12 +0000 (13:17 -0700)
This way, we restart peering using the same criteria as
check_new_interval.

Fixes: #8104
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/PG.cc
src/osd/PG.h

index 03f5b6e2780abfcb77f34d06ed62fcc0dd104487..3cbea636d34f4813f3cb928afa93ec4be1a1c37c 100644 (file)
@@ -4552,24 +4552,28 @@ bool PG::may_need_replay(const OSDMapRef osdmap) const
   return crashed;
 }
 
-bool PG::is_split(OSDMapRef lastmap, OSDMapRef nextmap)
-{
-  return info.pgid.is_split(
-    lastmap->get_pg_num(pool.id),
-    nextmap->get_pg_num(pool.id),
-    0);
-}
-
-bool PG::acting_up_affected(
+bool PG::should_restart_peering(
   int newupprimary,
   int newactingprimary,
-  const vector<int>& newup, const vector<int>& newacting)
-{
-  if (newupprimary != up_primary.osd ||
-      newactingprimary != primary.osd ||
-      acting != newacting ||
-      up != newup) {
-    dout(20) << "acting_up_affected newup " << newup
+  const vector<int>& newup,
+  const vector<int>& newacting,
+  OSDMapRef lastmap,
+  OSDMapRef osdmap)
+{
+  if (pg_interval_t::is_new_interval(
+       primary.osd,
+       newactingprimary,
+       acting,
+       newacting,
+       up_primary.osd,
+       newupprimary,
+       up,
+       newup,
+       osdmap,
+       lastmap,
+       info.pgid.pool(),
+       info.pgid.pgid)) {
+    dout(20) << "new interval newup " << newup
             << " newacting " << newacting << dendl;
     return true;
   } else {
@@ -5376,13 +5380,14 @@ boost::statechart::result PG::RecoveryState::Started::react(const AdvMap& advmap
 {
   dout(10) << "Started advmap" << dendl;
   PG *pg = context< RecoveryMachine >().pg;
-  if (pg->acting_up_affected(
+  if (pg->should_restart_peering(
        advmap.up_primary,
        advmap.acting_primary,
        advmap.newup,
-       advmap.newacting) ||
-      pg->is_split(advmap.lastmap, advmap.osdmap)) {
-    dout(10) << "up or acting affected, transitioning to Reset" << dendl;
+       advmap.newacting,
+       advmap.lastmap,
+       advmap.osdmap)) {
+    dout(10) << "should_restart_peering, transitioning to Reset" << dendl;
     post_event(advmap);
     return transit< Reset >();
   }
@@ -5435,13 +5440,14 @@ boost::statechart::result PG::RecoveryState::Reset::react(const AdvMap& advmap)
   // _before_ we are active.
   pg->generate_past_intervals();
 
-  if (pg->acting_up_affected(
+  if (pg->should_restart_peering(
        advmap.up_primary,
        advmap.acting_primary,
        advmap.newup,
-       advmap.newacting) ||
-      pg->is_split(advmap.lastmap, advmap.osdmap)) {
-    dout(10) << "up or acting affected, calling start_peering_interval again"
+       advmap.newacting,
+       advmap.lastmap,
+       advmap.osdmap)) {
+    dout(10) << "should restart peering, calling start_peering_interval again"
             << dendl;
     pg->start_peering_interval(
       advmap.lastmap,
index b750231e28c328995cd42335723ce9b19d20622f..dbd8f7b1a3bddaccd143e970559d36f982a191f2 100644 (file)
@@ -2037,10 +2037,14 @@ public:
   void fulfill_info(pg_shard_t from, const pg_query_t &query,
                    pair<pg_shard_t, pg_info_t> &notify_info);
   void fulfill_log(pg_shard_t from, const pg_query_t &query, epoch_t query_epoch);
-  bool is_split(OSDMapRef lastmap, OSDMapRef nextmap);
-  bool acting_up_affected(
-    int newupprimary, int newactingprimary,
-    const vector<int>& newup, const vector<int>& newacting);
+
+  bool should_restart_peering(
+    int newupprimary,
+    int newactingprimary,
+    const vector<int>& newup,
+    const vector<int>& newacting,
+    OSDMapRef lastmap,
+    OSDMapRef osdmap);
 
   // OpRequest queueing
   bool can_discard_op(OpRequestRef op);