o.back()->name = "foo";
}
-
// -- pg_pool_t --
void pg_pool_t::dump(Formatter *f) const
f->dump_bool("use_gmt_hitset", use_gmt_hitset);
f->dump_unsigned("min_read_recency_for_promote", min_read_recency_for_promote);
f->dump_unsigned("min_write_recency_for_promote", min_write_recency_for_promote);
+ f->dump_unsigned("hit_set_grade_decay_rate", hit_set_grade_decay_rate);
+ f->dump_unsigned("hit_set_search_last_n", hit_set_search_last_n);
+ f->open_array_section("grade_table");
+ for (unsigned i = 0; i < hit_set_count; ++i)
+ f->dump_unsigned("value", get_grade(i));
+ f->close_section();
f->dump_unsigned("stripe_width", get_stripe_width());
f->dump_unsigned("expected_num_objects", expected_num_objects);
f->dump_bool("fast_read", fast_read);
return;
}
- ENCODE_START(22, 5, bl);
+ ENCODE_START(23, 5, bl);
::encode(type, bl);
::encode(size, bl);
::encode(crush_ruleset, bl);
::encode(min_write_recency_for_promote, bl);
::encode(use_gmt_hitset, bl);
::encode(fast_read, bl);
+ ::encode(hit_set_grade_decay_rate, bl);
+ ::encode(hit_set_search_last_n, bl);
ENCODE_FINISH(bl);
}
void pg_pool_t::decode(bufferlist::iterator& bl)
{
- DECODE_START_LEGACY_COMPAT_LEN(22, 5, 5, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(23, 5, 5, bl);
::decode(type, bl);
::decode(size, bl);
::decode(crush_ruleset, bl);
} else {
fast_read = false;
}
+ if (struct_v >= 23) {
+ ::decode(hit_set_grade_decay_rate, bl);
+ ::decode(hit_set_search_last_n, bl);
+ } else {
+ hit_set_grade_decay_rate = 0;
+ hit_set_search_last_n = 1;
+ }
DECODE_FINISH(bl);
calc_pg_masks();
+ calc_grade_table();
}
void pg_pool_t::generate_test_instances(list<pg_pool_t*>& o)
a.hit_set_count = 8;
a.min_read_recency_for_promote = 1;
a.min_write_recency_for_promote = 1;
+ a.hit_set_grade_decay_rate = 50;
+ a.hit_set_search_last_n = 1;
+ a.calc_grade_table();
a.set_stripe_width(12345);
a.target_max_bytes = 1238132132;
a.target_max_objects = 1232132;
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;
+ << " x" << p.hit_set_count << " decay_rate "
+ << p.hit_set_grade_decay_rate
+ << " search_last_n " << p.hit_set_search_last_n;
}
if (p.min_read_recency_for_promote)
out << " min_read_recency_for_promote " << p.min_read_recency_for_promote;
hit_set_params = HitSet::Params();
hit_set_period = 0;
hit_set_count = 0;
+ hit_set_grade_decay_rate = 0;
+ hit_set_search_last_n = 0;
+ grade_table.resize(0);
}
uint64_t target_max_bytes; ///< tiering: target max pool size
bool use_gmt_hitset; ///< use gmt to name the hitset archive object
uint32_t min_read_recency_for_promote; ///< minimum number of HitSet to check before promote on read
uint32_t min_write_recency_for_promote; ///< minimum number of HitSet to check before promote on write
+ uint32_t hit_set_grade_decay_rate; ///< current hit_set has highest priority on objects
+ ///temperature count,the follow hit_set's priority decay
+ ///by this params than pre hit_set
+ uint32_t hit_set_search_last_n; ///<accumulate atmost N hit_sets for temperature
uint32_t stripe_width; ///< erasure coded stripe size in bytes
///< user does not specify any expected value
bool fast_read; ///< whether turn on fast read on the pool or not
+private:
+ vector<uint32_t> grade_table;
+
+public:
+ uint32_t get_grade(unsigned i) const {
+ if (grade_table.size() <= i)
+ return 0;
+ return grade_table[i];
+ }
+ void calc_grade_table() {
+ unsigned v = 1000000;
+ grade_table.resize(hit_set_count);
+ for (unsigned i = 0; i < hit_set_count; i++) {
+ v = v * (1 - (hit_set_grade_decay_rate / 100.0));
+ grade_table[i] = v;
+ }
+ }
+
pg_pool_t()
: flags(0), type(0), size(0), min_size(0),
crush_ruleset(0), object_hash(0),
use_gmt_hitset(true),
min_read_recency_for_promote(0),
min_write_recency_for_promote(0),
+ hit_set_grade_decay_rate(0),
+ hit_set_search_last_n(0),
stripe_width(0),
expected_num_objects(0),
fast_read(false)