]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/: splitting a pg now triggers a new interval
authorSamuel Just <sam.just@inktank.com>
Thu, 20 Sep 2012 00:30:43 +0000 (17:30 -0700)
committerSamuel Just <sam.just@inktank.com>
Wed, 5 Dec 2012 19:34:18 +0000 (11:34 -0800)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PG.h
src/osd/osd_types.cc
src/osd/osd_types.h

index 27d6829bdf1962d0be1a04aac725abc444de1ec4..f9ea8624be16af49c5af11d54602a68581c29a4b 100644 (file)
@@ -1532,6 +1532,7 @@ void OSD::build_past_intervals_parallel()
                                                            pg->info.history.last_epoch_clean,
                                                            cur_map, last_map,
                                                            pg->info.pgid.pool(),
+                                                           pg->info.pgid,
                                                            &pg->past_intervals,
                                                            &debug);
       if (new_interval) {
index 8c4c29ba7e75b5dbf506b900ae31b2bc55884bd8..89ae7d06d79419a94574c7f7294fc30bef8baf55 100644 (file)
@@ -869,6 +869,7 @@ void PG::generate_past_intervals()
       cur_map,
       last_map,
       info.pgid.pool(),
+      info.pgid,
       &past_intervals,
       &debug);
     if (new_interval) {
@@ -4318,6 +4319,13 @@ 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(const vector<int>& newup, const vector<int>& newacting)
 {
@@ -4426,14 +4434,14 @@ void PG::start_peering_interval(const OSDMapRef lastmap,
       info.history.same_interval_since,
       info.history.last_epoch_clean,
       osdmap,
-      lastmap, info.pgid.pool(), &past_intervals);
+      lastmap, info.pgid.pool(), info.pgid, &past_intervals);
     if (new_interval) {
       dout(10) << " noting past " << past_intervals.rbegin()->second << dendl;
       dirty_info = true;
     }
   }
 
-  if (oldacting != acting || oldup != up) {
+  if (oldacting != acting || oldup != up || is_split(lastmap, osdmap)) {
     info.history.same_interval_since = osdmap->get_epoch();
   }
   if (oldup != up) {
@@ -4968,7 +4976,8 @@ 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(advmap.newup, advmap.newacting)) {
+  if (pg->acting_up_affected(advmap.newup, advmap.newacting) ||
+    pg->is_split(advmap.lastmap, advmap.osdmap)) {
     dout(10) << "up or acting affected, transitioning to Reset" << dendl;
     post_event(advmap);
     return transit< Reset >();
@@ -5020,7 +5029,8 @@ boost::statechart::result PG::RecoveryState::Reset::react(const AdvMap& advmap)
   pg->generate_past_intervals();
 
   pg->remove_down_peer_info(advmap.osdmap);
-  if (pg->acting_up_affected(advmap.newup, advmap.newacting)) {
+  if (pg->acting_up_affected(advmap.newup, advmap.newacting) ||
+    pg->is_split(advmap.lastmap, advmap.osdmap)) {
     dout(10) << "up or acting affected, calling start_peering_interval again"
             << dendl;
     pg->start_peering_interval(advmap.lastmap, advmap.newup, advmap.newacting);
index b9693fb072a6295c450d084a0eb14b667ed8f2ba..536f04dda6416018530faf22acdfec36f5d17cb8 100644 (file)
@@ -1729,6 +1729,7 @@ public:
   void fulfill_info(int from, const pg_query_t &query, 
                    pair<int, pg_info_t> &notify_info);
   void fulfill_log(int from, const pg_query_t &query, epoch_t query_epoch);
+  bool is_split(OSDMapRef lastmap, OSDMapRef nextmap);
   bool acting_up_affected(const vector<int>& newup, const vector<int>& newacting);
 
   // OpRequest queueing
index 4a1b3fcf2ef1e95c6e19df27ce18fb23ee58bb3a..c65797b99880b728647f3e7eb3a761636fe0e4db 100644 (file)
@@ -1478,14 +1478,17 @@ bool pg_interval_t::check_new_interval(
   OSDMapRef osdmap,
   OSDMapRef lastmap,
   int64_t pool_id,
+  pg_t pgid,
   map<epoch_t, pg_interval_t> *past_intervals,
   std::ostream *out)
 {
   // remember past interval
   if (new_acting != old_acting || new_up != old_up ||
       (!(lastmap->get_pools().count(pool_id))) ||
-      lastmap->get_pools().find(pool_id)->second.min_size !=
-      osdmap->get_pools().find(pool_id)->second.min_size) {
+      (lastmap->get_pools().find(pool_id)->second.min_size !=
+       osdmap->get_pools().find(pool_id)->second.min_size)  ||
+      pgid.is_split(lastmap->get_pg_num(pgid.pool()),
+        osdmap->get_pg_num(pgid.pool()), 0)) {
     pg_interval_t& i = (*past_intervals)[same_interval_since];
     i.first = same_interval_since;
     i.last = osdmap->get_epoch() - 1;
index da2b2abf319b18eb15f1fccedc418b2a32f53b0e..0cc961965d7338623686342a8e2383c5b9b89feb 100644 (file)
@@ -1144,6 +1144,7 @@ struct pg_interval_t {
     std::tr1::shared_ptr<const OSDMap> osdmap,  ///< [in] current map
     std::tr1::shared_ptr<const OSDMap> lastmap, ///< [in] last map
     int64_t poolid,                             ///< [in] pool for pg
+    pg_t pgid,                                  ///< [in] pgid for pg
     map<epoch_t, pg_interval_t> *past_intervals,///< [out] intervals
     ostream *out = 0                            ///< [out] debug ostream
     );