]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG/Backend: move handle_*
authorSamuel Just <sam.just@inktank.com>
Sun, 1 Sep 2013 21:01:21 +0000 (14:01 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 26 Sep 2013 18:24:26 +0000 (11:24 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/ReplicatedBackend.h
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index bba797e5ae5e0b09b4576bcee80a839d346b59ac..e705bb9108c6b005dd0bdb323f6a1fb186062231 100644 (file)
@@ -216,18 +216,18 @@ private:
   void do_pull(OpRequestRef op);
   void do_push_reply(OpRequestRef op);
 
-  bool handle_push_reply(int peer, PushReplyOp &op, PushOp *reply) { return true; }
-  void handle_pull(int peer, PullOp &op, PushOp *reply) {}
+  bool handle_push_reply(int peer, PushReplyOp &op, PushOp *reply);
+  void handle_pull(int peer, PullOp &op, PushOp *reply);
   bool handle_pull_response(int from, PushOp &op, PullOp *response,
-                           ObjectStore::Transaction *t) { return true; }
+                           ObjectStore::Transaction *t);
   void handle_push(int from, PushOp &op, PushReplyOp *response,
-                  ObjectStore::Transaction *t) {}
+                  ObjectStore::Transaction *t);
 
   static void trim_pushed_data(const interval_set<uint64_t> &copy_subset,
                               const interval_set<uint64_t> &intervals_received,
                               bufferlist data_received,
                               interval_set<uint64_t> *intervals_usable,
-                              bufferlist *data_usable) {}
+                              bufferlist *data_usable);
   void _failed_push(int from, const hobject_t &soid) {}
 
   void send_pushes(int prio, map<int, vector<PushOp> > &pushes) {}
index 5560813af8e6bd943662752f89539756081e906f..dd2755debee014c88373bc85d35dddd9bb43e07e 100644 (file)
@@ -6229,7 +6229,7 @@ ObjectRecoveryInfo ReplicatedPG::recalc_subsets(const ObjectRecoveryInfo& recove
   return new_info;
 }
 
-bool ReplicatedPG::handle_pull_response(
+bool ReplicatedBackend::handle_pull_response(
   int from, PushOp &pop, PullOp *response,
   ObjectStore::Transaction *t)
 {
@@ -6263,7 +6263,8 @@ bool ReplicatedPG::handle_pull_response(
       pop.recovery_info.copy_subset);
   }
 
-  pi.recovery_info = recalc_subsets(pi.recovery_info);
+  // TODOSAM: probably just kill this
+  //pi.recovery_info = recalc_subsets(pi.recovery_info);
 
   interval_set<uint64_t> usable_intervals;
   bufferlist usable_data;
@@ -6275,7 +6276,8 @@ bool ReplicatedPG::handle_pull_response(
   data_included = usable_intervals;
   data.claim(usable_data);
 
-  info.stats.stats.sum.num_bytes_recovered += data.length();
+  // TODOSAM: add into the stats passed into on_local_recover
+  //info.stats.stats.sum.num_bytes_recovered += data.length();
 
   bool first = pi.recovery_progress.first;
   pi.recovery_progress = pop.after_progress;
@@ -6312,13 +6314,16 @@ bool ReplicatedPG::handle_pull_response(
                   pop.omap_entries,
                   t);
 
-  info.stats.stats.sum.num_keys_recovered += pop.omap_entries.size();
+  // TODOSAM: add into the stats passed into on_local_recover
+  //info.stats.stats.sum.num_keys_recovered += pop.omap_entries.size();
 
   if (complete) {
     pulling.erase(hoid);
     pull_from_peer[from].erase(hoid);
-    info.stats.stats.sum.num_objects_recovered++;
-    on_local_recover(hoid, object_stat_sum_t(), pi.recovery_info, pi.obc, t);
+    // TODOSAM: add into the stats passed into on_local_recover
+    //info.stats.stats.sum.num_objects_recovered++;
+    get_parent()->on_local_recover(
+      hoid, object_stat_sum_t(), pi.recovery_info, pi.obc, t);
     return false;
   } else {
     response->soid = pop.soid;
@@ -6338,7 +6343,7 @@ struct C_OnPushCommit : public Context {
   }
 };
 
-void ReplicatedPG::handle_push(
+void ReplicatedBackend::handle_push(
   int from, PushOp &pop, PushReplyOp *response,
   ObjectStore::Transaction *t)
 {
@@ -6364,7 +6369,7 @@ void ReplicatedPG::handle_push(
                   t);
 
   if (complete)
-    on_local_recover(
+    get_parent()->on_local_recover(
       pop.recovery_info.soid,
       object_stat_sum_t(),
       pop.recovery_info,
@@ -6611,7 +6616,7 @@ void ReplicatedBackend::sub_op_push_reply(OpRequestRef op)
     send_push_op_legacy(pushing[soid][peer].priority, peer, pop);
 }
 
-bool ReplicatedPG::handle_push_reply(int peer, PushReplyOp &op, PushOp *reply)
+bool ReplicatedBackend::handle_push_reply(int peer, PushReplyOp &op, PushOp *reply)
 {
   const hobject_t &soid = op.soid;
   if (pushing.count(soid) == 0) {
@@ -6638,14 +6643,14 @@ bool ReplicatedPG::handle_push_reply(int peer, PushReplyOp &op, PushOp *reply)
       return true;
     } else {
       // done!
-      on_peer_recover(peer, soid, pi->recovery_info);
+      get_parent()->on_peer_recover(peer, soid, pi->recovery_info);
       
       pushing[soid].erase(peer);
       pi = NULL;
       
       
       if (pushing[soid].empty()) {
-       on_global_recover(soid);
+       get_parent()->on_global_recover(soid);
       } else {
        dout(10) << "pushed " << soid << ", still waiting for push ack from " 
                 << pushing[soid].size() << " others" << dendl;
@@ -6713,13 +6718,14 @@ void ReplicatedBackend::sub_op_pull(OpRequestRef op)
   log_subop_stats(osd, op, 0, l_osd_sop_pull_lat);
 }
 
-void ReplicatedPG::handle_pull(int peer, PullOp &op, PushOp *reply)
+void ReplicatedBackend::handle_pull(int peer, PullOp &op, PushOp *reply)
 {
   const hobject_t &soid = op.soid;
   struct stat st;
   int r = osd->store->stat(coll, soid, &st);
   if (r != 0) {
-    osd->clog.error() << info.pgid << " " << peer << " tried to pull " << soid
+    osd->clog.error() << get_info().pgid << " "
+                     << peer << " tried to pull " << soid
                      << " but got " << cpp_strerror(-r) << "\n";
     prep_push_op_blank(soid, reply);
   } else {
@@ -6836,7 +6842,7 @@ void ReplicatedPG::recover_got(hobject_t oid, eversion_t v)
  * @param intervals_usable intervals we want to keep
  * @param data_usable matching data we want to keep
  */
-void ReplicatedPG::trim_pushed_data(
+void ReplicatedBackend::trim_pushed_data(
   const interval_set<uint64_t> &copy_subset,
   const interval_set<uint64_t> &intervals_received,
   bufferlist data_received,
index cc3f9f571345359078b426f06830f14aa5121f7d..fcbb2d58dc4d6cb11e5d7d370300578bc0c18bb2 100644 (file)
@@ -545,17 +545,6 @@ protected:
   map<hobject_t, PullInfo> pulling;
 
   ObjectRecoveryInfo recalc_subsets(const ObjectRecoveryInfo& recovery_info);
-  static void trim_pushed_data(const interval_set<uint64_t> &copy_subset,
-                              const interval_set<uint64_t> &intervals_received,
-                              bufferlist data_received,
-                              interval_set<uint64_t> *intervals_usable,
-                              bufferlist *data_usable);
-  bool handle_pull_response(
-    int from, PushOp &op, PullOp *response,
-    ObjectStore::Transaction *t);
-  void handle_push(
-    int from, PushOp &op, PushReplyOp *response,
-    ObjectStore::Transaction *t);
   void send_pushes(int prio, map<int, vector<PushOp> > &pushes);
   int build_push_op(const ObjectRecoveryInfo &recovery_info,
                    const ObjectRecoveryProgress &progress,
@@ -851,8 +840,6 @@ protected:
   void _committed_pushed_object(epoch_t epoch, eversion_t lc);
   void recover_got(hobject_t oid, eversion_t v);
   void _failed_push(int from, const hobject_t &soid);
-  bool handle_push_reply(int peer, PushReplyOp &op, PushOp *reply);
-  void handle_pull(int peer, PullOp &op, PushOp *reply);
 
   // -- copyfrom --
   map<hobject_t, CopyOpRef> copy_ops;