From d5ca7e9d1e75418290d439d9801e6bc15e2d917a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 16 Jul 2015 13:14:45 -0400 Subject: [PATCH] osd/osd_types: add last_backfill_bitwise flag to pg_info_t We need to know what sort order last_backfill is based on. Signed-off-by: Sage Weil --- src/osd/osd_types.cc | 27 ++++++++++++++++++++++----- src/osd/osd_types.h | 10 +++++++--- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index df9f5974e7770..f557d3498973a 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -2374,12 +2374,16 @@ void pg_history_t::generate_test_instances(list& o) void pg_info_t::encode(bufferlist &bl) const { - ENCODE_START(30, 26, bl); + ENCODE_START(31, 26, bl); ::encode(pgid.pgid, bl); ::encode(last_update, bl); ::encode(last_complete, bl); ::encode(log_tail, bl); - ::encode(last_backfill, bl); + if (last_backfill_bitwise && last_backfill != last_backfill.get_max()) { + ::encode(hobject_t(), bl); + } else { + ::encode(last_backfill, bl); + } ::encode(stats, bl); history.encode(bl); ::encode(purged_snaps, bl); @@ -2387,12 +2391,14 @@ void pg_info_t::encode(bufferlist &bl) const ::encode(last_user_version, bl); ::encode(hit_set, bl); ::encode(pgid.shard, bl); + ::encode(last_backfill, bl); + ::encode(last_backfill_bitwise, bl); ENCODE_FINISH(bl); } void pg_info_t::decode(bufferlist::iterator &bl) { - DECODE_START_LEGACY_COMPAT_LEN(29, 26, 26, bl); + DECODE_START_LEGACY_COMPAT_LEN(31, 26, 26, bl); if (struct_v < 23) { old_pg_t opgid; ::decode(opgid, bl); @@ -2407,8 +2413,10 @@ void pg_info_t::decode(bufferlist::iterator &bl) bool log_backlog; ::decode(log_backlog, bl); } - if (struct_v >= 24) - ::decode(last_backfill, bl); + hobject_t old_last_backfill; + if (struct_v >= 24) { + ::decode(old_last_backfill, bl); + } ::decode(stats, bl); history.decode(bl); if (struct_v >= 22) @@ -2432,6 +2440,13 @@ void pg_info_t::decode(bufferlist::iterator &bl) ::decode(pgid.shard, bl); else pgid.shard = shard_id_t::NO_SHARD; + if (struct_v >= 31) { + ::decode(last_backfill, bl); + ::decode(last_backfill_bitwise, bl); + } else { + last_backfill = old_last_backfill; + last_backfill_bitwise = false; + } DECODE_FINISH(bl); } @@ -2445,6 +2460,7 @@ void pg_info_t::dump(Formatter *f) const f->dump_stream("log_tail") << log_tail; f->dump_int("last_user_version", last_user_version); f->dump_stream("last_backfill") << last_backfill; + f->dump_int("last_backfill_bitwise", (int)last_backfill_bitwise); f->dump_stream("purged_snaps") << purged_snaps; f->open_object_section("history"); history.dump(f); @@ -2476,6 +2492,7 @@ void pg_info_t::generate_test_instances(list& 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, ""); + o.back()->last_backfill_bitwise = true; { list s; pg_stat_t::generate_test_instances(s); diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 4d4579a4dd39b..737817319362f 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -1835,6 +1835,7 @@ struct pg_info_t { eversion_t log_tail; // oldest log entry. hobject_t last_backfill; // objects >= this and < last_complete may be missing + bool last_backfill_bitwise; ///< true if last_backfill reflects a bitwise (vs nibblewise) sort interval_set purged_snaps; @@ -1845,12 +1846,14 @@ struct pg_info_t { pg_info_t() : last_epoch_started(0), last_user_version(0), - last_backfill(hobject_t::get_max()) + last_backfill(hobject_t::get_max()), + last_backfill_bitwise(false) { } pg_info_t(spg_t p) : pgid(p), last_epoch_started(0), last_user_version(0), - last_backfill(hobject_t::get_max()) + last_backfill(hobject_t::get_max()), + last_backfill_bitwise(false) { } bool is_empty() const { return last_update.version == 0; } @@ -1884,7 +1887,8 @@ inline ostream& operator<<(ostream& out, const pg_info_t& pgi) out << " (" << pgi.log_tail << "," << pgi.last_update << "]"; } if (pgi.is_incomplete()) - out << " lb " << pgi.last_backfill; + out << " lb " << pgi.last_backfill + << (pgi.last_backfill_bitwise ? " (bitwise)" : " (NIBBLEWISE)"); //out << " c " << pgi.epoch_created; out << " local-les=" << pgi.last_epoch_started; out << " n=" << pgi.stats.stats.sum.num_objects; -- 2.39.5