]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/: Move init into PeeringState
authorSamuel Just <sjust@redhat.com>
Wed, 3 Apr 2019 23:56:47 +0000 (16:56 -0700)
committersjust@redhat.com <sjust@redhat.com>
Wed, 1 May 2019 18:22:24 +0000 (11:22 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PG.cc
src/osd/PeeringState.cc
src/osd/PeeringState.h

index c72ab4710a47cd39055e7cd1747c3082f8ee609c..039ec2199f9f1d9e331fc8620e27594e8988014b 100644 (file)
@@ -906,39 +906,9 @@ void PG::init(
   bool backfill,
   ObjectStore::Transaction *t)
 {
-  dout(10) << "init role " << role << " up " << newup << " acting " << newacting
-          << " history " << history
-          << " past_intervals " << pi
-          << dendl;
-
-  recovery_state.set_role(role);
-  recovery_state.init_primary_up_acting(
-    newup,
-    newacting,
-    new_up_primary,
-    new_acting_primary);
-
-  info.history = history;
-  past_intervals = pi;
-
-  info.stats.up = up;
-  info.stats.up_primary = new_up_primary;
-  info.stats.acting = acting;
-  info.stats.acting_primary = new_acting_primary;
-  info.stats.mapping_epoch = info.history.same_interval_since;
-
-  if (backfill) {
-    dout(10) << __func__ << ": Setting backfill" << dendl;
-    info.set_last_backfill(hobject_t());
-    info.last_complete = info.last_update;
-    pg_log.mark_log_for_rewrite();
-  }
-
-  recovery_state.on_new_interval();
-
-  dirty_info = true;
-  dirty_big_info = true;
-  write_if_dirty(*t);
+  recovery_state.init(
+    role, newup, new_up_primary, newacting,
+    new_acting_primary, history, pi, backfill, t);
 }
 
 void PG::shutdown()
index 0554136f60d8d39545cd1946c15d21a1b5d65536..6561d5298e2f46cb1a1f73256021a930be453535 100644 (file)
@@ -3289,6 +3289,51 @@ std::optional<pg_stat_t> PeeringState::prepare_stats_for_publish(
   }
 }
 
+void PeeringState::init(
+  int role,
+  const vector<int>& newup, int new_up_primary,
+  const vector<int>& newacting, int new_acting_primary,
+  const pg_history_t& history,
+  const PastIntervals& pi,
+  bool backfill,
+  ObjectStore::Transaction *t)
+{
+  psdout(10) << "init role " << role << " up "
+            << newup << " acting " << newacting
+            << " history " << history
+            << " past_intervals " << pi
+            << dendl;
+
+  set_role(role);
+  init_primary_up_acting(
+    newup,
+    newacting,
+    new_up_primary,
+    new_acting_primary);
+
+  info.history = history;
+  past_intervals = pi;
+
+  info.stats.up = up;
+  info.stats.up_primary = new_up_primary;
+  info.stats.acting = acting;
+  info.stats.acting_primary = new_acting_primary;
+  info.stats.mapping_epoch = info.history.same_interval_since;
+
+  if (backfill) {
+    psdout(10) << __func__ << ": Setting backfill" << dendl;
+    info.set_last_backfill(hobject_t());
+    info.last_complete = info.last_update;
+    pg_log.mark_log_for_rewrite();
+  }
+
+  on_new_interval();
+
+  dirty_info = true;
+  dirty_big_info = true;
+  write_if_dirty(*t);
+}
+
 /*------------ Peering State Machine----------------*/
 #undef dout_prefix
 #define dout_prefix (context< PeeringMachine >().dpp->gen_prefix(*_dout) \
index 1ea87b6bf03e47944e4cd8bd19b76cab65f4bd94..d6123bfda393894e24f18bd3d020ccca76115d68 100644 (file)
@@ -1452,6 +1452,15 @@ public:
     end_handle();
   }
 
+  void init(
+    int role,
+    const vector<int>& newup, int new_up_primary,
+    const vector<int>& newacting, int new_acting_primary,
+    const pg_history_t& history,
+    const PastIntervals& pi,
+    bool backfill,
+    ObjectStore::Transaction *t);
+
   void start_split_stats(
     const set<spg_t>& childpgs, vector<object_stat_sum_t> *out);
   void finish_split_stats(