diff options
author | Sage Weil <sage@inktank.com> | 2013-09-19 08:48:07 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-10-22 13:45:39 -0700 |
commit | f8054bb39345b934e7954e02d33415cc0c5c9833 (patch) | |
tree | 613c876f6a79f7fb533150cf7dd4582dc9fca258 | |
parent | 51e8aa9123f0130e5b66375fc638f50fd4896200 (diff) | |
download | ceph-f8054bb39345b934e7954e02d33415cc0c5c9833.tar.gz |
osd: add hit_set_* parameters to pg_pool_t
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>
-rw-r--r-- | src/osd/osd_types.cc | 37 | ||||
-rw-r--r-- | src/osd/osd_types.h | 18 |
2 files changed, 51 insertions, 4 deletions
diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index fc22b068649..65f6f27e29f 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -702,6 +702,10 @@ void pg_pool_t::dump(Formatter *f) const f->dump_string(name.c_str(), i->second); } f->close_section(); + f->dump_string("hit_set_type", HitSet::get_type_name(hit_set_type)); + f->dump_unsigned("hit_set_false_positive_probability", get_hit_set_fpp()); + f->dump_unsigned("hit_set_period", hit_set_period); + f->dump_unsigned("hit_set_count", hit_set_count); } @@ -924,7 +928,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const return; } - ENCODE_START(10, 5, bl); + ENCODE_START(11, 5, bl); ::encode(type, bl); ::encode(size, bl); ::encode(crush_ruleset, bl); @@ -952,12 +956,17 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const ::encode(read_tier, bl); ::encode(write_tier, bl); ::encode(properties, bl); + c = hit_set_type; + ::encode(c, bl); + ::encode(hit_set_fpp_micro, bl); + ::encode(hit_set_period, bl); + ::encode(hit_set_count, bl); ENCODE_FINISH(bl); } 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); @@ -1022,6 +1031,20 @@ void pg_pool_t::decode(bufferlist::iterator& bl) if (struct_v >= 10) { ::decode(properties, bl); } + if (struct_v >= 11) { + __u8 v; + ::decode(v, bl); + hit_set_type = (HitSet::type_t)v; + ::decode(hit_set_fpp_micro, bl); + ::decode(hit_set_period, bl); + ::decode(hit_set_count, bl); + } else { + pg_pool_t def; + hit_set_type = HitSet::TYPE_NONE; + hit_set_fpp_micro = def.hit_set_fpp_micro; + hit_set_period = def.hit_set_period; + hit_set_count = def.hit_set_count; + } DECODE_FINISH(bl); calc_pg_masks(); } @@ -1065,6 +1088,10 @@ 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_type = HitSet::TYPE_BLOOM; + a.hit_set_fpp_micro = 6000; + a.hit_set_period = 3600; + a.hit_set_count = 8; o.push_back(new pg_pool_t(a)); } @@ -1097,6 +1124,12 @@ 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_type != HitSet::TYPE_NONE) { + out << " hit_set " << HitSet::get_type_name(p.hit_set_type) + << " " << p.hit_set_period << "s" + << " " << p.get_hit_set_fpp() << "%" + << " x" << p.hit_set_count; + } return out; } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index cf46e3915b1..1b15877e747 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -30,6 +30,7 @@ #include "common/bloom_filter.hpp" #include "common/hobject.h" #include "common/snap_types.h" +#include "HitSet.h" #include "Watch.h" #define CEPH_OSD_ONDISK_MAGIC "ceph osd volume v026" @@ -826,7 +827,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; } @@ -834,6 +834,11 @@ public: bool has_write_tier() const { return write_tier >= 0; } void clear_write_tier() { write_tier = -1; } + HitSet::type_t hit_set_type; ///< type of HitSet + uint32_t hit_set_period; ///< periodicity of HitSet segments (seconds) + uint32_t hit_set_count; ///< number of periods to retain + uint16_t hit_set_fpp_micro; ///< false positive probability * 1000000 + pg_pool_t() : flags(0), type(0), size(0), min_size(0), crush_ruleset(0), object_hash(0), @@ -845,7 +850,11 @@ 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_type(HitSet::TYPE_NONE), + hit_set_period(3600), + hit_set_count(24), + hit_set_fpp_micro(10000) { } void dump(Formatter *f) const; @@ -900,6 +909,11 @@ public: return quota_max_objects; } + /// get bloom filter fpp + float get_hit_set_fpp() const { + return (float)hit_set_fpp_micro / 1000000.0; + } + static int calc_bits_of(int t); void calc_pg_masks(); |