]> git-server-git.apps.pok.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, 8 Oct 2014 22:49:36 +0000 (15:49 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 1f50750d0fd94ffddc14f3d7a1e95fa4449aa1b8)

Conflicts:
src/osd/ReplicatedPG.cc

src/osd/PG.h
src/osd/ReplicatedPG.cc

index 008c67a7db35907b81b116958a3cc984dba4a6ff..58753980f9df41e528b4b385b2a0a6dd15f73437 100644 (file)
@@ -451,9 +451,7 @@ protected:
     
     /// clear content
     void clear() {
-      objects.clear();
-      begin = end = hobject_t();
-      version = eversion_t();
+      *this = BackfillInterval();
     }
 
     void reset(hobject_t start) {
index 753e53c472e081f3954cb96c3c418b026393d1b5..2150f5dfdebe0afd6b05cc0b82f0b724d192f634 100644 (file)
@@ -1306,11 +1306,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(
        g_conf->osd_backfill_scan_min,
-       g_conf->osd_backfill_scan_max, &bi, handle);
+       g_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);
@@ -7352,9 +7355,6 @@ int ReplicatedPG::recover_backfill(
           << " interval " << pbi.begin << "-" << pbi.end
           << " " << pbi.objects.size() << " objects" << dendl;
 
-  int local_min = g_conf->osd_backfill_scan_min;
-  int local_max = g_conf->osd_backfill_scan_max;
-
   // update our local interval to cope with recent changes
   backfill_info.begin = backfill_pos;
   update_range(&backfill_info, handle);
@@ -7370,10 +7370,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;
@@ -7549,8 +7550,21 @@ void ReplicatedPG::update_range(
   BackfillInterval *bi,
   ThreadPool::TPHandle &handle)
 {
-  int local_min = cct->_conf->osd_backfill_scan_min;
-  int local_max = cct->_conf->osd_backfill_scan_max;
+  int local_min = g_conf->osd_backfill_scan_min;
+  int local_max = g_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);
@@ -7590,10 +7604,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");
   }
 }
 
@@ -7603,7 +7614,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;