]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: correctly handle backfill
authorSamuel Just <sam.just@inktank.com>
Mon, 9 Sep 2013 23:08:30 +0000 (16:08 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 26 Sep 2013 18:24:28 +0000 (11:24 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/ReplicatedBackend.cc
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 59ce9bbcceb77612f2a2a3dd61c1daff0e890c3d..9868e7af2c8771af7d9b090351f0495f8e770216 100644 (file)
@@ -61,7 +61,6 @@ void ReplicatedBackend::recover_object(
     return;
   } else {
     assert(obc);
-    assert(head);
     int started = start_pushes(
       hoid,
       obc,
index 1f688f97aa2e76b412ee1c02c8070e9ba4fb6ea9..350186af3e08d8c6d23a1cf935c389553dc46e5b 100644 (file)
@@ -223,10 +223,9 @@ void ReplicatedPG::on_peer_recover(
   info.stats.stats.sum.add(stat);
   publish_stats_to_osd();
   // done!
+  peer_missing[peer].got(soid, recovery_info.version);
   if (peer == backfill_target && backfills_in_flight.count(soid))
     backfills_in_flight.erase(soid);
-  else
-    peer_missing[peer].got(soid, recovery_info.version);
 }
 
 void ReplicatedPG::begin_peer_recover(
@@ -8053,16 +8052,16 @@ int ReplicatedPG::recover_backfill(
     send_remove_op(i->first, i->second, backfill_target);
   }
 
+  PGBackend::RecoveryHandle *h = pgbackend->open_recovery_op();
   map<int, vector<PushOp> > pushes;
   for (map<hobject_t, pair<eversion_t, eversion_t> >::iterator i = to_push.begin();
        i != to_push.end();
        ++i) {
     handle.reset_tp_timeout();
     prep_backfill_object_push(
-      i->first, i->second.first, i->second.second, backfill_target, &pushes);
+      i->first, i->second.first, i->second.second, backfill_target, h);
   }
-  // TODOSAM: replace
-  //send_pushes(g_conf->osd_recovery_op_priority, pushes);
+  pgbackend->run_recovery_op(h, cct->_conf->osd_recovery_op_priority);
 
   release_waiting_for_backfill_pos();
   dout(5) << "backfill_pos is " << backfill_pos << " and pinfo.last_backfill is "
@@ -8108,23 +8107,25 @@ int ReplicatedPG::recover_backfill(
 
 void ReplicatedPG::prep_backfill_object_push(
   hobject_t oid, eversion_t v, eversion_t have, int peer,
-  map<int, vector<PushOp> > *pushes)
+  PGBackend::RecoveryHandle *h)
 {
   dout(10) << "push_backfill_object " << oid << " v " << v << " to osd." << peer << dendl;
 
   backfills_in_flight.insert(oid);
+  map<int, pg_missing_t>::iterator bpm = peer_missing.find(backfill_target);
+  assert(bpm != peer_missing.end());
+  bpm->second.add(oid, eversion_t(), eversion_t());
+
+  assert(!recovering.count(oid));
 
-  if (!recovering.count(oid))
-    start_recovery_op(oid);
+  start_recovery_op(oid);
+  recovering.insert(oid);
   ObjectContextRef obc = get_object_context(oid, false);
-// TODOSAM: fix
-#if 0
-  obc->ondisk_read_lock();
-  (*pushes)[peer].push_back(PushOp());
-  prep_push_to_replica(obc, oid, peer, cct->_conf->osd_recovery_op_priority,
-                      &((*pushes)[peer].back()));
-  obc->ondisk_read_unlock();
-#endif
+  pgbackend->recover_object(
+    oid,
+    ObjectContextRef(),
+    obc,
+    h);
 }
 
 void ReplicatedPG::scan_range(
index cdd57e1581a08e95041c20d89452ac7908ad224d..54413c6aca07b4f4a9b6b361d579dc2847a74910 100644 (file)
@@ -629,7 +629,7 @@ protected:
 
   void prep_backfill_object_push(
     hobject_t oid, eversion_t v, eversion_t have, int peer,
-    map<int, vector<PushOp> > *pushes);
+    PGBackend::RecoveryHandle *h);
   void send_remove_op(const hobject_t& oid, eversion_t v, int peer);