]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: clean up push/pull
authorSamuel Just <samuel.just@dreamhost.com>
Tue, 14 Feb 2012 20:55:43 +0000 (12:55 -0800)
committerSamuel Just <samuel.just@dreamhost.com>
Tue, 14 Feb 2012 20:55:43 +0000 (12:55 -0800)
Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 60cee021f4f27ef1a9599ac30212bc609f22889a..a656f16dae83ac97f89f46610c031f4b641e0723 100644 (file)
@@ -4292,7 +4292,7 @@ void ReplicatedPG::handle_pull_response(OpRequest *op)
   bufferlist data;
   m->claim_data(data);
   interval_set<uint64_t> data_included = m->data_included;
-  dout(10) << "handle_push "
+  dout(10) << "handle_pull_response"
           << m->recovery_info
           << m->recovery_progress
           << " data.size() is " << data.length()
@@ -4308,7 +4308,6 @@ void ReplicatedPG::handle_pull_response(OpRequest *op)
   assert((data_included.empty() && data.length() == 0) ||
         (!data_included.empty() && data.length() > 0));
 
-
   if (!pulling.count(hoid)) {
     return;
   }
@@ -4335,8 +4334,7 @@ void ReplicatedPG::handle_pull_response(OpRequest *op)
   bool first = pi.recovery_progress.first;
   pi.recovery_progress = m->recovery_progress;
 
-  dout(10) << "new recovery_info: "
-          << pi.recovery_info
+  dout(10) << "new recovery_info " << pi.recovery_info
           << ", new progress " << pi.recovery_progress
           << dendl;
 
@@ -4358,9 +4356,7 @@ void ReplicatedPG::handle_pull_response(OpRequest *op)
     }
   }
 
-  bool complete = pi.recovery_progress.data_recovered_to >=
-    (pi.recovery_info.copy_subset.empty() ?
-     0 : pi.recovery_info.copy_subset.range_end());
+  bool complete = pi.is_complete();
 
   if (complete && !pi.recovery_progress.data_complete) {
     dout(0) << " uh oh, we reached EOF on peer before we got everything we wanted"
@@ -4532,11 +4528,9 @@ int ReplicatedPG::send_push(int peer,
   if (!subop->data_included.empty())
     new_progress.data_recovered_to = subop->data_included.range_end();
 
-  if (recovery_info.copy_subset.empty() ||
-      new_progress.data_recovered_to >= recovery_info.copy_subset.range_end())
+  if (new_progress.is_complete(recovery_info))
     new_progress.data_complete = true;
 
-
   osd->logger->inc(l_osd_push);
   osd->logger->inc(l_osd_push_outb, subop->ops[0].indata.length());
   
@@ -4764,6 +4758,16 @@ void ReplicatedPG::recover_got(hobject_t oid, eversion_t v)
   }
 }
 
+
+/**
+ * trim received data to remove what we don't want
+ *
+ * @param copy_subset intervals we want
+ * @param data_included intervals we got
+ * @param data_recieved data we got
+ * @param intervals_usable intervals we want to keep
+ * @param data_usable matching data we want to keep
+ */
 void ReplicatedPG::trim_pushed_data(
   const interval_set<uint64_t> &copy_subset,
   const interval_set<uint64_t> &intervals_received,
index 8c636fc7397b5ef82459d8cfe793f974016de603..ef7d087a21e61fd193ac2fa9291a0965472a1d14 100644 (file)
@@ -545,15 +545,19 @@ protected:
 
   // push
   struct PushInfo {
-    int in_progress;
     ObjectRecoveryProgress recovery_progress;
     ObjectRecoveryInfo recovery_info;
   };
   map<hobject_t, map<int, PushInfo> > pushing;
+
   // pull
   struct PullInfo {
     ObjectRecoveryProgress recovery_progress;
     ObjectRecoveryInfo recovery_info;
+
+    bool is_complete() const {
+      return recovery_progress.is_complete(recovery_info);
+    }
   };
   map<hobject_t, PullInfo> pulling;