From 93b3da6a26d4dc09fbf3df401b19c48af48f0223 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Wed, 13 Feb 2013 13:00:12 -0800 Subject: [PATCH] PG: place biginfo on the infos object next to the info and epoch keys This is simpler and possibly more efficient. Signed-off-by: Samuel Just --- src/osd/OSD.cc | 7 ++----- src/osd/OSD.h | 2 +- src/osd/PG.cc | 22 +++++++++------------- src/osd/PG.h | 5 ++++- src/tools/ceph-filestore-dump.cc | 3 +-- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 6be6dfc1f24cf..d52fdfac354fa 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -149,7 +149,6 @@ OSDService::OSDService(OSD *osd) : whoami(osd->whoami), store(osd->store), clog(osd->clog), pg_recovery_stats(osd->pg_recovery_stats), infos_oid(sobject_t("infos", CEPH_NOSNAP)), - biginfos_oid(sobject_t("biginfos", CEPH_NOSNAP)), cluster_messenger(osd->cluster_messenger), client_messenger(osd->client_messenger), logger(osd->logger), @@ -1623,12 +1622,10 @@ void OSD::load_pgs() dout(10) << "load_pgs done" << dendl; // make sure info objects exist - if (!store->exists(coll_t::META_COLL, service.infos_oid) || - !store->exists(coll_t::META_COLL, service.biginfos_oid)) { - dout(10) << "load_pgs creating/touching infos, biginfos objects" << dendl; + if (!store->exists(coll_t::META_COLL, service.infos_oid)) { + dout(10) << "load_pgs creating/touching infos object" << dendl; ObjectStore::Transaction t; t.touch(coll_t::META_COLL, service.infos_oid); - t.touch(coll_t::META_COLL, service.biginfos_oid); store->apply_transaction(t); } diff --git a/src/osd/OSD.h b/src/osd/OSD.h index c116d4b912a74..5680acca17873 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -169,7 +169,7 @@ public: ObjectStore *&store; LogClient &clog; PGRecoveryStats &pg_recovery_stats; - hobject_t infos_oid, biginfos_oid; + hobject_t infos_oid; private: Messenger *&cluster_messenger; Messenger *&client_messenger; diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 6bd803282b708..8f2933d40d56a 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2345,19 +2345,17 @@ void PG::write_info(ObjectStore::Transaction& t) ::encode(info, v[get_info_key(info.pgid)]); purged_snaps.swap(info.purged_snaps); - t.omap_setkeys(coll_t::META_COLL, osd->infos_oid, v); - if (dirty_big_info) { // potentially big stuff - v.clear(); - bufferlist& bigbl = v[get_info_key(info.pgid)]; + bufferlist& bigbl = v[get_biginfo_key(info.pgid)]; ::encode(past_intervals, bigbl); ::encode(snap_collections, bigbl); ::encode(info.purged_snaps, bigbl); dout(20) << "write_info bigbl " << bigbl.length() << dendl; - t.omap_setkeys(coll_t::META_COLL, osd->biginfos_oid, v); } + t.omap_setkeys(coll_t::META_COLL, osd->infos_oid, v); + dirty_info = false; dirty_big_info = false; } @@ -2647,7 +2645,7 @@ std::string PG::get_corrupt_pg_log_name() const int PG::read_info( ObjectStore *store, const coll_t coll, bufferlist &bl, pg_info_t &info, map &past_intervals, - hobject_t &biginfo_oid, hobject_t &infos_oid, hobject_t &biginfos_oid, + hobject_t &biginfo_oid, hobject_t &infos_oid, interval_set &snap_collections, __u8 &struct_v) { bufferlist::iterator p = bl.begin(); @@ -2674,20 +2672,18 @@ int PG::read_info( } else { // get info out of leveldb string k = get_info_key(info.pgid); + string bk = get_biginfo_key(info.pgid); set keys; keys.insert(k); + keys.insert(bk); map values; store->omap_get_values(coll_t::META_COLL, infos_oid, keys, &values); - assert(values.size() == 1); + assert(values.size() == 2); lbl = values[k]; p = lbl.begin(); ::decode(info, p); - // biginfo - values.clear(); - store->omap_get_values(coll_t::META_COLL, biginfos_oid, keys, &values); - assert(values.size() == 1); - lbl = values[k]; + lbl = values[bk]; p = lbl.begin(); ::decode(past_intervals, p); } @@ -2715,7 +2711,7 @@ int PG::read_info( void PG::read_state(ObjectStore *store, bufferlist &bl) { int r = read_info(store, coll, bl, info, past_intervals, biginfo_oid, - osd->infos_oid, osd->biginfos_oid, snap_collections, info_struct_v); + osd->infos_oid, snap_collections, info_struct_v); assert(r >= 0); try { diff --git a/src/osd/PG.h b/src/osd/PG.h index 28bcd282cdf46..379037181d787 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -427,6 +427,9 @@ public: static string get_info_key(pg_t pgid) { return stringify(pgid) + "_info"; } + static string get_biginfo_key(pg_t pgid) { + return stringify(pgid) + "_biginfo"; + } static string get_epoch_key(pg_t pgid) { return stringify(pgid) + "_epoch"; } @@ -1795,7 +1798,7 @@ public: static int read_info( ObjectStore *store, const coll_t coll, bufferlist &bl, pg_info_t &info, map &past_intervals, - hobject_t &biginfo_oid, hobject_t &infos_oid, hobject_t &biginfos_oid, + hobject_t &biginfo_oid, hobject_t &infos_oid, interval_set &snap_collections, __u8 &); void read_state(ObjectStore *store, bufferlist &bl); static epoch_t peek_map_epoch(ObjectStore *store, coll_t coll, diff --git a/src/tools/ceph-filestore-dump.cc b/src/tools/ceph-filestore-dump.cc index 612ddee235e60..fbd227dc25fba 100644 --- a/src/tools/ceph-filestore-dump.cc +++ b/src/tools/ceph-filestore-dump.cc @@ -205,7 +205,6 @@ int main(int argc, char **argv) } //XXX: This needs OSD function to generate - hobject_t biginfos_oid(sobject_t("biginfos", CEPH_NOSNAP)); hobject_t infos_oid(sobject_t("infos", CEPH_NOSNAP)); bufferlist bl; epoch_t map_epoch = PG::peek_map_epoch(fs, coll, infos_oid, &bl); @@ -220,7 +219,7 @@ int main(int argc, char **argv) __u8 struct_v; int r = PG::read_info(fs, coll, bl, info, past_intervals, biginfo_oid, - infos_oid, biginfos_oid, snap_collections, struct_v); + infos_oid, snap_collections, struct_v); if (r < 0) { cerr << "read_info error " << cpp_strerror(-r) << std::endl; ret = 1; -- 2.39.5