]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/osd_types: include pg_hit_set_history_t in pg_info_t
authorSage Weil <sage@inktank.com>
Thu, 3 Oct 2013 23:40:15 +0000 (16:40 -0700)
committerSage Weil <sage@inktank.com>
Fri, 6 Dec 2013 22:37:27 +0000 (14:37 -0800)
Track metadata about the currently accumulating HitSet as well as
previously archived ones in the pg_info_t.  This will not scale well for
extremely long histories, but does let us avoid explicitly sharing this
metadata during recovery or other normal update activity.

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/osd_types.cc
src/osd/osd_types.h

index 38fd623def33a5567b006e8f7a6c5316afc8ef86..cb1e4688942f5c34172112555627ce77d8feef63 100644 (file)
@@ -1676,7 +1676,7 @@ void pg_history_t::generate_test_instances(list<pg_history_t*>& o)
 
 void pg_info_t::encode(bufferlist &bl) const
 {
-  ENCODE_START(28, 26, bl);
+  ENCODE_START(29, 26, bl);
   ::encode(pgid, bl);
   ::encode(last_update, bl);
   ::encode(last_complete, bl);
@@ -1687,12 +1687,13 @@ void pg_info_t::encode(bufferlist &bl) const
   ::encode(purged_snaps, bl);
   ::encode(last_epoch_started, bl);
   ::encode(last_user_version, bl);
+  ::encode(hit_set, bl);
   ENCODE_FINISH(bl);
 }
 
 void pg_info_t::decode(bufferlist::iterator &bl)
 {
-  DECODE_START_LEGACY_COMPAT_LEN(28, 26, 26, bl);
+  DECODE_START_LEGACY_COMPAT_LEN(29, 26, 26, bl);
   if (struct_v < 23) {
     old_pg_t opgid;
     ::decode(opgid, bl);
@@ -1726,6 +1727,8 @@ void pg_info_t::decode(bufferlist::iterator &bl)
     ::decode(last_user_version, bl);
   else
     last_user_version = last_update.version;
+  if (struct_v >= 29)
+    ::decode(hit_set, bl);
   DECODE_FINISH(bl);
 }
 
@@ -1751,6 +1754,10 @@ void pg_info_t::dump(Formatter *f) const
   f->dump_int("dne", dne());
   f->dump_int("incomplete", is_incomplete());
   f->dump_int("last_epoch_started", last_epoch_started);
+
+  f->open_object_section("hit_set_history");
+  hit_set.dump(f);
+  f->close_section();
 }
 
 void pg_info_t::generate_test_instances(list<pg_info_t*>& o)
@@ -1766,9 +1773,16 @@ void pg_info_t::generate_test_instances(list<pg_info_t*>& o)
   o.back()->last_user_version = 2;
   o.back()->log_tail = eversion_t(7, 8);
   o.back()->last_backfill = hobject_t(object_t("objname"), "key", 123, 456, -1, "");
-  list<pg_stat_t*> s;
-  pg_stat_t::generate_test_instances(s);
-  o.back()->stats = *s.back();
+  {
+    list<pg_stat_t*> s;
+    pg_stat_t::generate_test_instances(s);
+    o.back()->stats = *s.back();
+  }
+  {
+    list<pg_hit_set_history_t*> s;
+    pg_hit_set_history_t::generate_test_instances(s);
+    o.back()->hit_set = *s.back();
+  }
 }
 
 // -- pg_notify_t --
index 5bd357ca724f8ea9f03b9a4e078c83f07cfcceef..0cbc92bae3871ba223750bf53d5a3a74101c8d45 100644 (file)
@@ -1232,8 +1232,8 @@ struct pg_hit_set_info_t {
   eversion_t version;   ///< version this HitSet object was written
 
   pg_hit_set_info_t() : size(0), target_size(0) {}
-  pg_hit_set_info_t(uint32_t target, utime_t st)
-    : size(0), target_size(target), begin(st) {}
+  pg_hit_set_info_t(uint32_t target, utime_t b)
+    : size(0), target_size(target), begin(b) {}
 
   bool is_full() const {
     return size && size >= target_size;
@@ -1384,6 +1384,7 @@ struct pg_info_t {
   pg_stat_t stats;
 
   pg_history_t history;
+  pg_hit_set_history_t hit_set;
 
   pg_info_t()
     : last_epoch_started(0), last_user_version(0),