]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: remove the other backfill related flushes
authorSamuel Just <sam.just@inktank.com>
Fri, 4 Oct 2013 05:00:46 +0000 (22:00 -0700)
committerSamuel Just <sam.just@inktank.com>
Wed, 9 Oct 2013 20:35:42 +0000 (13:35 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/PG.h
src/osd/ReplicatedPG.cc

index 275d30c7658486b03744d52b779a8767113ce194..9b42ff4272b2c11f092ff117f9a5fa2f3b4cc45d 100644 (file)
@@ -449,9 +449,7 @@ protected:
     
     /// clear content
     void clear() {
-      objects.clear();
-      begin = end = hobject_t();
-      version = eversion_t();
+      *this = BackfillInterval();
     }
 
     void reset(hobject_t start) {
index 781ba33ec35d6625f24560a7b16614e24015e16f..c4dccf68442fa894f3bde8a5cf902171e72502d6 100644 (file)
@@ -1549,11 +1549,14 @@ void ReplicatedPG::do_scan(
       }
 
       BackfillInterval bi;
-      osr->flush();
       bi.begin = m->begin;
+      // No need to flush, there won't be any in progress writes occuring
+      // past m->begin
       scan_range(
        cct->_conf->osd_backfill_scan_min,
-       cct->_conf->osd_backfill_scan_max, &bi, handle);
+       cct->_conf->osd_backfill_scan_max,
+       &bi,
+       handle);
       MOSDPGScan *reply = new MOSDPGScan(MOSDPGScan::OP_SCAN_DIGEST,
                                         get_osdmap()->get_epoch(), m->query_epoch,
                                         info.pgid, bi.begin, bi.end);
@@ -7930,9 +7933,6 @@ int ReplicatedPG::recover_backfill(
           << " interval " << pbi.begin << "-" << pbi.end
           << " " << pbi.objects.size() << " objects" << dendl;
 
-  int local_min = cct->_conf->osd_backfill_scan_min;
-  int local_max = cct->_conf->osd_backfill_scan_max;
-
   // update our local interval to cope with recent changes
   backfill_info.begin = backfill_pos;
   update_range(&backfill_info, handle);
@@ -7948,10 +7948,11 @@ int ReplicatedPG::recover_backfill(
   while (ops < max) {
     if (backfill_info.begin <= pbi.begin &&
        !backfill_info.extends_to_end() && backfill_info.empty()) {
-      osr->flush();
-      backfill_info.begin = backfill_info.end;
-      scan_range(local_min, local_max, &backfill_info,
-                handle);
+      hobject_t next = backfill_info.end;
+      backfill_info.clear();
+      backfill_info.begin = next;
+      backfill_info.end = hobject_t::get_max();
+      update_range(&backfill_info, handle);
       backfill_info.trim();
     }
     backfill_pos = backfill_info.begin > pbi.begin ? pbi.begin : backfill_info.begin;
@@ -8128,6 +8129,19 @@ void ReplicatedPG::update_range(
 {
   int local_min = cct->_conf->osd_backfill_scan_min;
   int local_max = cct->_conf->osd_backfill_scan_max;
+
+  if (bi->version < info.log_tail) {
+    dout(10) << __func__<< ": bi is old, rescanning local backfill_info"
+            << dendl;
+    if (last_update_applied >= info.log_tail) {
+      bi->version = last_update_applied;
+    } else {
+      osr->flush();
+      bi->version = info.last_update;
+    }
+    scan_range(local_min, local_max, bi, handle);
+  }
+
   if (bi->version >= info.last_update) {
     dout(10) << __func__<< ": bi is current " << dendl;
     assert(bi->version == info.last_update);
@@ -8167,10 +8181,7 @@ void ReplicatedPG::update_range(
     }
     bi->version = info.last_update;
   } else {
-    dout(10) << __func__<< ": bi is old, rescanning local backfill_info"
-            << dendl;
-    osr->flush();
-    scan_range(local_min, local_max, &backfill_info, handle);
+    assert(0 == "scan_range should have raised bi->version past log_tail");
   }
 }
 
@@ -8180,7 +8191,6 @@ void ReplicatedPG::scan_range(
 {
   assert(is_locked());
   dout(10) << "scan_range from " << bi->begin << dendl;
-  bi->version = info.last_update;
   bi->objects.clear();  // for good measure
 
   vector<hobject_t> ls;