]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG,PG: dump recovery/backfill state on pg query
authorSamuel Just <sam.just@inktank.com>
Fri, 6 Jul 2012 21:38:57 +0000 (14:38 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 12 Jul 2012 21:06:03 +0000 (14:06 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/ReplicatedPG.h

index d048e20da7dfde7e1c21a6e5041860c11811bc95..14c5d581a3980f6067833f9710c35e06eaa8a783 100644 (file)
@@ -152,7 +152,6 @@ void PG::IndexedLog::trim(ObjectStore::Transaction& t, eversion_t s)
     tail = s;
 }
 
-
 /********* PG **********/
 
 void PG::proc_master_log(ObjectStore::Transaction& t, pg_info_t &oinfo, pg_log_t &olog, pg_missing_t& omissing, int from)
@@ -4749,6 +4748,11 @@ boost::statechart::result PG::RecoveryState::Active::react(const QueryState& q)
     }
     q.f->close_section();
   }
+  {
+    q.f->open_object_section("recovery_progress");
+    pg->dump_recovery_info(q.f);
+    q.f->close_section();
+  }
 
   {
     q.f->open_object_section("scrub");
index c885c29148e0f4bb03bb5bc7eb07f6160b067aec..f5a1070beed6bdeb3698f4c91548a081918459e8 100644 (file)
@@ -589,6 +589,22 @@ protected:
       else
        begin = objects.begin()->first;
     }
+
+    /// dump
+    void dump(Formatter *f) const {
+      f->dump_stream("begin") << begin;
+      f->dump_stream("end") << end;
+      f->open_array_section("objects");
+      for (map<hobject_t, eversion_t>::const_iterator i = objects.begin();
+          i != objects.end();
+          ++i) {
+       f->open_object_section("object");
+       f->dump_stream("object") << i->first;
+       f->dump_stream("version") << i->second;
+       f->close_section();
+      }
+      f->close_section();
+    }
   };
   
   BackfillInterval backfill_info;
@@ -656,6 +672,7 @@ public:
 
   bool all_unfound_are_queried_or_lost(const OSDMapRef osdmap) const;
   virtual void mark_all_unfound_lost(int how) = 0;
+  virtual void dump_recovery_info(Formatter *f) const = 0;
 
   bool calc_min_last_complete_ondisk() {
     eversion_t min = last_complete_ondisk;
index 8c7112110e048dbf6be3237c0b1e307b3164b7fc..e886b17d902fff59fba089cec0f7a667a199b7d5 100644 (file)
@@ -562,6 +562,19 @@ protected:
   struct PushInfo {
     ObjectRecoveryProgress recovery_progress;
     ObjectRecoveryInfo recovery_info;
+
+    void dump(Formatter *f) const {
+      {
+       f->open_object_section("recovery_progress");
+       recovery_progress.dump(f);
+       f->close_section();
+      }
+      {
+       f->open_object_section("recovery_info");
+       recovery_info.dump(f);
+       f->close_section();
+      }
+    }
   };
   map<hobject_t, map<int, PushInfo> > pushing;
 
@@ -570,6 +583,19 @@ protected:
     ObjectRecoveryProgress recovery_progress;
     ObjectRecoveryInfo recovery_info;
 
+    void dump(Formatter *f) const {
+      {
+       f->open_object_section("recovery_progress");
+       recovery_progress.dump(f);
+       f->close_section();
+      }
+      {
+       f->open_object_section("recovery_info");
+       recovery_info.dump(f);
+       f->close_section();
+      }
+    }
+
     bool is_complete() const {
       return recovery_progress.is_complete(recovery_info);
     }
@@ -619,6 +645,82 @@ protected:
   set<hobject_t> backfills_in_flight;
   map<hobject_t, pg_stat_t> pending_backfill_updates;
 
+  void dump_recovery_info(Formatter *f) const {
+    f->dump_int("backfill_target", get_backfill_target());
+    f->dump_int("waiting_on_backfill", waiting_on_backfill);
+    f->dump_stream("backfill_pos") << backfill_pos;
+    {
+      f->open_object_section("backfill_info");
+      backfill_info.dump(f);
+      f->close_section();
+    }
+    {
+      f->open_object_section("peer_backfill_info");
+      peer_backfill_info.dump(f);
+      f->close_section();
+    }
+    {
+      f->open_array_section("backfills_in_flight");
+      for (set<hobject_t>::const_iterator i = backfills_in_flight.begin();
+          i != backfills_in_flight.end();
+          ++i) {
+       f->dump_stream("object") << *i;
+      }
+      f->close_section();
+    }
+    {
+      f->open_array_section("pull_from_peer");
+      for (map<int, set<hobject_t> >::const_iterator i = pull_from_peer.begin();
+          i != pull_from_peer.end();
+          ++i) {
+       f->open_object_section("pulling_from");
+       f->dump_int("pull_from", i->first);
+       {
+         f->open_array_section("pulls");
+         for (set<hobject_t>::const_iterator j = i->second.begin();
+              j != i->second.end();
+              ++j) {
+           f->open_object_section("pull_info");
+           assert(pulling.count(*j));
+           pulling.find(*j)->second.dump(f);
+           f->close_section();
+         }
+         f->close_section();
+       }
+       f->close_section();
+      }
+      f->close_section();
+    }
+    {
+      f->open_array_section("pushing");
+      for (map<hobject_t, map<int, PushInfo> >::const_iterator i =
+            pushing.begin();
+          i != pushing.end();
+          ++i) {
+       f->open_object_section("object");
+       f->dump_stream("pushing") << i->first;
+       {
+         f->open_array_section("pushing_to");
+         for (map<int, PushInfo>::const_iterator j = i->second.begin();
+              j != i->second.end();
+              ++j) {
+           f->open_object_section("push_progress");
+           f->dump_stream("object_pushing") << j->first;
+           {
+             f->open_object_section("push_info");
+             j->second.dump(f);
+             f->close_section();
+           }
+           f->close_section();
+         }
+         f->close_section();
+       }
+       f->close_section();
+      }
+      f->close_section();
+    }
+  }
+
   /// leading edge of backfill
   hobject_t backfill_pos;