]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: base project_pg_history on is_new_interval
authorSage Weil <sage@redhat.com>
Thu, 16 Aug 2018 17:30:02 +0000 (12:30 -0500)
committerSage Weil <sage@redhat.com>
Fri, 7 Sep 2018 17:09:42 +0000 (12:09 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h

index 0e302c385fe33fd33000449500e4bf1b96a41683..3e3e5129f4506e90d77c21a811bf4a1975850570 100644 (file)
@@ -4370,7 +4370,7 @@ void OSD::build_initial_pg_history(
  * and same_primary_since.
  */
 bool OSD::project_pg_history(spg_t pgid, pg_history_t& h, epoch_t from,
-                            const OSDMap& endmap,
+                            const OSDMapRef& endmap,
                             const vector<int>& currentup,
                             int currentupprimary,
                             const vector<int>& currentacting,
@@ -4391,7 +4391,6 @@ bool OSD::project_pg_history(spg_t pgid, pg_history_t& h, epoch_t from,
       dout(15) << __func__ << ": found map gap, returning false" << dendl;
       return false;
     }
-    ceph_assert(oldmap->have_pg_pool(pgid.pool()));
 
     int upprimary, actingprimary;
     vector<int> up, acting;
@@ -4402,25 +4401,18 @@ bool OSD::project_pg_history(spg_t pgid, pg_history_t& h, epoch_t from,
       &acting,
       &actingprimary);
 
-    // acting set change?
-    if ((actingprimary != currentactingprimary ||
-        upprimary != currentupprimary ||
-        acting != currentacting ||
-        up != currentup) && e > h.same_interval_since) {
-      dout(15) << "project_pg_history " << pgid << " acting|up changed in " << e
-              << " from " << acting << "/" << up
-              << " " << actingprimary << "/" << upprimary
-              << " -> " << currentacting << "/" << currentup
-              << " " << currentactingprimary << "/" << currentupprimary
-              << dendl;
-      h.same_interval_since = e;
-    }
-    // split?
-    if (pgid.is_split(oldmap->get_pg_num(pgid.pool()),
-                     endmap->get_pg_num(pgid.pool()),
-                     0) && e > h.same_interval_since) {
+    if (e > h.same_interval_since &&
+       PastIntervals::is_new_interval(
+         actingprimary, currentactingprimary,
+         acting, currentacting,
+         upprimary, currentupprimary,
+         up, currentup,
+         oldmap, endmap,
+         pgid.pgid)) {
+      dout(15) << "project_pg_history " << pgid << " interval changed in " << e << dendl;
       h.same_interval_since = e;
     }
+
     // up set change?
     if ((up != currentup || upprimary != currentupprimary)
        && e > h.same_up_since) {
index 1e1e529a187e8307623756556fae4a67869f0d39..cace749e139b4a0186ea1c7768556c6e510cf40b 100644 (file)
@@ -1926,7 +1926,7 @@ protected:
   /// project pg history from from to now
   bool project_pg_history(
     spg_t pgid, pg_history_t& h, epoch_t from,
-    const OSDMap &osdmap,
+    const OSDMapRef &osdmap,
     const vector<int>& lastup,
     int lastupprimary,
     const vector<int>& lastacting,