peer_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
acting_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
upacting_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
- do_sort_bitwise(false)
+ do_sort_bitwise(false),
+ last_epoch(0)
{
#ifdef PG_DEBUG_REFS
osd->add_pgid(p, this);
pg_info_t &info, coll_t coll,
map<epoch_t,pg_interval_t> &past_intervals,
ghobject_t &pgmeta_oid,
- bool dirty_big_info)
+ bool dirty_big_info,
+ bool dirty_epoch)
{
// info. store purged_snaps separately.
interval_set<snapid_t> purged_snaps;
- ::encode(epoch, (*km)[epoch_key]);
+ if (dirty_epoch)
+ ::encode(epoch, (*km)[epoch_key]);
purged_snaps.swap(info.purged_snaps);
::encode(info, (*km)[info_key]);
purged_snaps.swap(info.purged_snaps);
info.stats.stats.add(unstable_stats);
unstable_stats.clear();
+ bool need_update_epoch = last_epoch < get_osdmap()->get_epoch();
int ret = _prepare_write_info(km, get_osdmap()->get_epoch(), info, coll,
past_intervals, pgmeta_oid,
- dirty_big_info);
+ dirty_big_info, need_update_epoch);
assert(ret == 0);
+ if (need_update_epoch)
+ last_epoch = get_osdmap()->get_epoch();
last_persisted_osdmap_ref = osdmap_ref;
dirty_info = false;
uint64_t upacting_features;
bool do_sort_bitwise;
+ epoch_t last_epoch;
public:
const spg_t& get_pgid() const { return pg_id; }
pg_info_t &info, coll_t coll,
map<epoch_t,pg_interval_t> &past_intervals,
ghobject_t &pgmeta_oid,
- bool dirty_big_info);
+ bool dirty_big_info,
+ bool dirty_epoch);
void write_if_dirty(ObjectStore::Transaction& t);
eversion_t get_next_version() const {