This is simpler and possibly more efficient.
Signed-off-by: Samuel Just <sam.just@inktank.com>
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),
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);
}
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;
::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;
}
int PG::read_info(
ObjectStore *store, const coll_t coll, bufferlist &bl,
pg_info_t &info, map<epoch_t,pg_interval_t> &past_intervals,
- hobject_t &biginfo_oid, hobject_t &infos_oid, hobject_t &biginfos_oid,
+ hobject_t &biginfo_oid, hobject_t &infos_oid,
interval_set<snapid_t> &snap_collections, __u8 &struct_v)
{
bufferlist::iterator p = bl.begin();
} else {
// get info out of leveldb
string k = get_info_key(info.pgid);
+ string bk = get_biginfo_key(info.pgid);
set<string> keys;
keys.insert(k);
+ keys.insert(bk);
map<string,bufferlist> 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);
}
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 {
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";
}
static int read_info(
ObjectStore *store, const coll_t coll,
bufferlist &bl, pg_info_t &info, map<epoch_t,pg_interval_t> &past_intervals,
- hobject_t &biginfo_oid, hobject_t &infos_oid, hobject_t &biginfos_oid,
+ hobject_t &biginfo_oid, hobject_t &infos_oid,
interval_set<snapid_t> &snap_collections, __u8 &);
void read_state(ObjectStore *store, bufferlist &bl);
static epoch_t peek_map_epoch(ObjectStore *store, coll_t coll,
}
//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);
__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;