};
const struct CompatSet::Feature ceph_osd_feature_incompat[] = {
CEPH_OSD_FEATURE_INCOMPAT_BASE,
+ CEPH_OSD_FEATURE_INCOMPAT_PGINFO,
END_FEATURE
};
const struct CompatSet::Feature ceph_osd_feature_ro_compat[] = {
// create
PG *pg;
sobject_t logoid = make_pg_log_oid(pgid);
+ sobject_t infooid = make_pg_biginfo_oid(pgid);
if (osdmap->get_pg_type(pgid) == CEPH_PG_TYPE_REP)
- pg = new ReplicatedPG(this, pool, pgid, logoid);
+ pg = new ReplicatedPG(this, pool, pgid, logoid, infooid);
//else if (pgid.is_raid4())
//pg = new RAID4PG(this, pgid);
else
dout(10) << "_remove_pg " << pgid << " removing final" << dendl;
{
+ rmt->remove(coll_t::META_COLL, pg->log_oid);
+ rmt->remove(coll_t::META_COLL, pg->biginfo_oid);
rmt->remove_collection(coll_t(pgid));
int tr = store->queue_transaction(NULL, rmt);
assert(tr == 0);
return sobject_t(object_t(s.c_str()), 0);
}
+ sobject_t make_pg_biginfo_oid(pg_t pg) {
+ stringstream ss;
+ ss << "pginfo_" << pg;
+ string s;
+ getline(ss, s);
+ return sobject_t(object_t(s.c_str()), 0);
+ }
+
private:
// -- superblock --
{
// pg state
bufferlist infobl;
- __u8 struct_v = 1;
+ __u8 struct_v = 2;
::encode(struct_v, infobl);
::encode(info, infobl);
- ::encode(past_intervals, infobl);
dout(20) << "write_info info " << infobl.length() << dendl;
t.collection_setattr(coll, "info", infobl);
- // local state
- bufferlist snapbl;
- struct_v = 1;
- ::encode(struct_v, snapbl);
- ::encode(snap_collections, snapbl);
- dout(20) << "write_info snap " << snapbl.length() << dendl;
- t.collection_setattr(coll, "snap_collections", snapbl);
+ // potentially big stuff
+ bufferlist bigbl;
+ ::encode(past_intervals, bigbl);
+ ::encode(snap_collections, bigbl);
+ dout(20) << "write_info bigbl " << bigbl.length() << dendl;
+ t.truncate(coll_t::META_COLL, biginfo_oid, 0);
+ t.write(coll_t::META_COLL, biginfo_oid, 0, bigbl.length(), bigbl);
dirty_info = false;
}
p = bl.begin();
::decode(struct_v, p);
::decode(info, p);
- ::decode(past_intervals, p);
+ if (struct_v < 2) {
+ ::decode(past_intervals, p);
- // snap_collections
- bl.clear();
- store->collection_getattr(coll, "snap_collections", bl);
- p = bl.begin();
- ::decode(struct_v, p);
- ::decode(snap_collections, p);
+ // snap_collections
+ bl.clear();
+ store->collection_getattr(coll, "snap_collections", bl);
+ p = bl.begin();
+ ::decode(struct_v, p);
+ ::decode(snap_collections, p);
+ } else {
+ bl.clear();
+ store->read(coll_t::META_COLL, biginfo_oid, 0, 0, bl);
+ p = bl.begin();
+ ::decode(past_intervals, p);
+ ::decode(snap_collections, p);
+ }
try {
read_log(store);
const coll_t coll;
IndexedLog log;
sobject_t log_oid;
+ sobject_t biginfo_oid;
OndiskLog ondisklog;
Missing missing;
map<sobject_t, set<int> > missing_loc;
public:
- PG(OSD *o, PGPool *_pool, pg_t p, const sobject_t& oid) :
+ PG(OSD *o, PGPool *_pool, pg_t p, const sobject_t& loid, const sobject_t& ioid) :
osd(o), pool(_pool),
_lock("PG::_lock"),
ref(0), deleting(false), dirty_info(false), dirty_log(false),
- info(p), coll(p), log_oid(oid),
+ info(p), coll(p), log_oid(loid), biginfo_oid(ioid),
recovery_item(this), backlog_item(this), scrub_item(this), snap_trim_item(this), remove_item(this), stat_queue_item(this),
recovery_ops_active(0),
generate_backlog_epoch(0),
int do_xattr_cmp_str(int op, string& v1s, bufferlist& xattr);
public:
- ReplicatedPG(OSD *o, PGPool *_pool, pg_t p, const sobject_t& oid) :
- PG(o, _pool, p, oid)
+ ReplicatedPG(OSD *o, PGPool *_pool, pg_t p, const sobject_t& oid, const sobject_t& ioid) :
+ PG(o, _pool, p, oid, ioid)
{ }
~ReplicatedPG() {}
#define CEPH_OSD_FULL_RATIO .95
#define CEPH_OSD_FEATURE_INCOMPAT_BASE CompatSet::Feature(1, "initial feature set(~v.18)")
+#define CEPH_OSD_FEATURE_INCOMPAT_PGINFO CompatSet::Feature(1, "pginfo object")
/* osdreqid_t - caller name + incarnation# + tid to unique identify this request