PG: Place info in biginfo object

The purged_snaps set can grow without bound as snaps are
created and removed.  Because the filestore doesn't
provide unlimited size collection attributes, it's better
to place the full info on the biginfo object, since we
need to write it during write_info anyway.

Added CEPH_OSD_FEATURE_INCOMPAT_BIGINFO to prevent downgrade.

Signed-off-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
Samuel Just 2012-06-22 10:11:38 -07:00
parent 12d70738d1
commit 1b8819bbac
3 changed files with 8 additions and 4 deletions

View File

@ -134,6 +134,7 @@ static CompatSet get_osd_compat_set() {
ceph_osd_feature_incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_LEC);
ceph_osd_feature_incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_CATEGORIES);
ceph_osd_feature_incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_HOBJECTPOOL);
ceph_osd_feature_incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_BIGINFO);
return CompatSet(ceph_osd_feature_compat, ceph_osd_feature_ro_compat,
ceph_osd_feature_incompat);
}

View File

@ -1994,16 +1994,15 @@ void PG::write_info(ObjectStore::Transaction& t)
{
// pg state
bufferlist infobl;
__u8 struct_v = 3;
__u8 struct_v = 4;
::encode(struct_v, infobl);
::encode(info, infobl);
dout(20) << "write_info info " << infobl.length() << dendl;
t.collection_setattr(coll, "info", infobl);
// potentially big stuff
bufferlist bigbl;
::encode(past_intervals, bigbl);
::encode(snap_collections, bigbl);
::encode(info, 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);
@ -2434,7 +2433,8 @@ void PG::read_state(ObjectStore *store)
store->collection_getattr(coll, "info", bl);
p = bl.begin();
::decode(struct_v, p);
::decode(info, p);
if (struct_v < 4)
::decode(info, p);
if (struct_v < 2) {
::decode(past_intervals, p);
@ -2461,6 +2461,8 @@ void PG::read_state(ObjectStore *store)
}
} else {
::decode(snap_collections, p);
if (struct_v >= 4)
::decode(info, p);
}
try {

View File

@ -37,6 +37,7 @@
#define CEPH_OSD_FEATURE_INCOMPAT_LEC CompatSet::Feature(4, "last_epoch_clean")
#define CEPH_OSD_FEATURE_INCOMPAT_CATEGORIES CompatSet::Feature(5, "categories")
#define CEPH_OSD_FEATURE_INCOMPAT_HOBJECTPOOL CompatSet::Feature(6, "hobjectpool")
#define CEPH_OSD_FEATURE_INCOMPAT_BIGINFO CompatSet::Feature(7, "biginfo")
typedef hobject_t collection_list_handle_t;