]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: only commit past intervals at end of parallel build
authorSage Weil <sage@inktank.com>
Wed, 25 Jul 2012 21:53:34 +0000 (14:53 -0700)
committerSage Weil <sage@inktank.com>
Thu, 16 Aug 2012 20:32:56 +0000 (13:32 -0700)
We don't check for gaps in the past intervals, so we should only commit
this when we are completely done.  Otherwise a partial run and rsetart will
leave the gap in place, which may confuse the peering code that relies on
this information.

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

index e7e751e919e290c99f5cf2e6ae60feb8b2a7b05d..ded5c6bf7a43cbd80a8fc955a3dbc3e7b8c69fdb 100644 (file)
@@ -1466,8 +1466,6 @@ void OSD::build_past_intervals_parallel()
     last_map = cur_map;
     cur_map = get_map(cur_epoch);
 
-    ObjectStore::Transaction t;
-
     for (map<PG*,pistate>::iterator i = pis.begin(); i != pis.end(); ++i) {
       PG *pg = i->first;
       pistate& p = i->second;
@@ -1503,13 +1501,21 @@ void OSD::build_past_intervals_parallel()
        p.old_up = up;
        p.old_acting = acting;
        p.same_interval_since = cur_epoch;
-       pg->write_info(t);
       }
     }
+  }
 
-    if (!t.empty())
-      store->apply_transaction(t);
+  // write info only at the end.  this is necessary because we check
+  // whether the past_intervals go far enough back or forward in time,
+  // but we don't check for holes.  we could avoid it by discarding
+  // the previous past_intervals and rebuilding from scratch, or we
+  // can just do this and commit all our work at the end.
+  ObjectStore::Transaction t;
+  for (map<PG*,pistate>::iterator i = pis.begin(); i != pis.end(); ++i) {
+    PG *pg = i->first;
+    pg->write_info(t);
   }
+  store->apply_transaction(t);
 }