]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add hit_set_* parameters to pg_pool_t
authorSage Weil <sage@inktank.com>
Thu, 19 Sep 2013 15:48:07 +0000 (08:48 -0700)
committerSage Weil <sage@inktank.com>
Fri, 6 Dec 2013 22:37:27 +0000 (14:37 -0800)
Add pool properties to control what type of HitSet we want to use, along with
some (mostly generic) parameters.

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

index cb1e4688942f5c34172112555627ce77d8feef63..aa3de4af5d6bb41a59e7a8fd102de4fcf4bcc2eb 100644 (file)
@@ -709,6 +709,11 @@ void pg_pool_t::dump(Formatter *f) const
     f->dump_string(name.c_str(), i->second);
   }
   f->close_section();
+  f->open_object_section("hit_set_params");
+  hit_set_params.dump(f);
+  f->close_section(); // hit_set_params
+  f->dump_unsigned("hit_set_period", hit_set_period);
+  f->dump_unsigned("hit_set_count", hit_set_count);
 }
 
 
@@ -931,7 +936,8 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const
     return;
   }
 
-  ENCODE_START(10, 5, bl);
+  __u8 encode_compat = 5;
+  ENCODE_START(11, encode_compat, bl);
   ::encode(type, bl);
   ::encode(size, bl);
   ::encode(crush_ruleset, bl);
@@ -959,12 +965,17 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const
   ::encode(read_tier, bl);
   ::encode(write_tier, bl);
   ::encode(properties, bl);
-  ENCODE_FINISH(bl);
+  if (hit_set_params.get_type() != HitSet::TYPE_NONE)
+    encode_compat = MAX(encode_compat, 11); // need to be able to understand all the data!
+  ::encode(hit_set_params, bl);
+  ::encode(hit_set_period, bl);
+  ::encode(hit_set_count, bl);
+  ENCODE_FINISH_NEW_COMPAT(bl, encode_compat);
 }
 
 void pg_pool_t::decode(bufferlist::iterator& bl)
 {
-  DECODE_START_LEGACY_COMPAT_LEN(7, 5, 5, bl);
+  DECODE_START_LEGACY_COMPAT_LEN(11, 5, 5, bl);
   ::decode(type, bl);
   ::decode(size, bl);
   ::decode(crush_ruleset, bl);
@@ -1029,6 +1040,15 @@ void pg_pool_t::decode(bufferlist::iterator& bl)
   if (struct_v >= 10) {
     ::decode(properties, bl);
   }
+  if (struct_v >= 11) {
+    ::decode(hit_set_params, bl);
+    ::decode(hit_set_period, bl);
+    ::decode(hit_set_count, bl);
+  } else {
+    pg_pool_t def;
+    hit_set_period = def.hit_set_period;
+    hit_set_count = def.hit_set_count;
+  }
   DECODE_FINISH(bl);
   calc_pg_masks();
 }
@@ -1072,6 +1092,9 @@ void pg_pool_t::generate_test_instances(list<pg_pool_t*>& o)
   a.write_tier = 1;
   a.properties["p-1"] = "v-1";
   a.properties["empty"] = string();
+  a.hit_set_params = HitSet::Params(new BloomHitSet::Params);
+  a.hit_set_period = 3600;
+  a.hit_set_count = 8;
   o.push_back(new pg_pool_t(a));
 }
 
@@ -1104,6 +1127,11 @@ ostream& operator<<(ostream& out, const pg_pool_t& p)
     out << " write_tier " << p.write_tier;
   if (p.cache_mode)
     out << " cache_mode " << p.get_cache_mode_name();
+  if (p.hit_set_params.get_type() != HitSet::TYPE_NONE) {
+    out << " hit_set (" << p.hit_set_params
+       << ") " << p.hit_set_period << "s"
+       << " x" << p.hit_set_count;
+  }
   return out;
 }
 
index 0cbc92bae3871ba223750bf53d5a3a74101c8d45..8be8fd3b1f6c5f1a524ed06a6a8c08a0b5ca965d 100644 (file)
@@ -30,6 +30,7 @@
 #include "common/bloom_filter.hpp"
 #include "common/hobject.h"
 #include "common/snap_types.h"
+#include "HitSet.h"
 #include "Watch.h"
 #include "OpRequest.h"
 
@@ -809,7 +810,6 @@ public:
   int64_t write_tier;      ///< pool/tier for objecter to direct writes to
   cache_mode_t cache_mode;  ///< cache pool mode
 
-
   bool is_tier() const { return tier_of >= 0; }
   void clear_tier() { tier_of = -1; }
   bool has_read_tier() const { return read_tier >= 0; }
@@ -817,6 +817,10 @@ public:
   bool has_write_tier() const { return write_tier >= 0; }
   void clear_write_tier() { write_tier = -1; }
 
+  HitSet::Params hit_set_params; ///< The HitSet params to use on this pool
+  uint32_t hit_set_period;      ///< periodicity of HitSet segments (seconds)
+  uint32_t hit_set_count;       ///< number of periods to retain
+
   pg_pool_t()
     : flags(0), type(0), size(0), min_size(0),
       crush_ruleset(0), object_hash(0),
@@ -828,7 +832,10 @@ public:
       quota_max_bytes(0), quota_max_objects(0),
       pg_num_mask(0), pgp_num_mask(0),
       tier_of(-1), read_tier(-1), write_tier(-1),
-      cache_mode(CACHEMODE_NONE)
+      cache_mode(CACHEMODE_NONE),
+      hit_set_params(),
+      hit_set_period(0),
+      hit_set_count(0)
   { }
 
   void dump(Formatter *f) const;