From: Samuel Just Date: Thu, 13 Jan 2011 19:10:31 +0000 (-0800) Subject: OSD: _pg_process_info refactor to use adjust_local_snaps X-Git-Tag: v0.24.2~26^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6e610a90a37d42712f07114058863970e887caac;p=ceph.git OSD: _pg_process_info refactor to use adjust_local_snaps Changes _pg_process_info to use adjust_local_snaps. Also accounts for the incoming info not being a superset of the existing info. Signed-off-by: Samuel Just --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a51f645440497..a7716a44067a9 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3991,35 +3991,25 @@ void OSD::_process_pg_info(epoch_t epoch, int from, dout(10) << *pg << " writing updated stats" << dendl; pg->info.stats = info.stats; - // did a snap just get purged? - if (info.purged_snaps.size() < pg->info.purged_snaps.size()) { - stringstream ss; - ss << "pg " << pg->info.pgid << " replica got purged_snaps " << info.purged_snaps - << " had " << pg->info.purged_snaps; - logclient.log(LOG_WARN, ss); - pg->info.purged_snaps = info.purged_snaps; - } else { - interval_set p = info.purged_snaps; - p.subtract(pg->info.purged_snaps); - if (!p.empty()) { - dout(10) << " purged_snaps " << pg->info.purged_snaps - << " -> " << info.purged_snaps - << " removed " << p << dendl; - snapid_t sn = p.range_start(); - coll_t c(info.pgid, sn); - t->remove_collection(c); - - pg->info.purged_snaps = info.purged_snaps; - } - } - - pg->write_info(*t); - - if (!log.empty()) { - dout(10) << *pg << ": inactive replica merging new PG log entries" << dendl; - pg->merge_log(*t, info, log, from); + // Handle changes to purged_snaps + interval_set p; + p.union_of(info.purged_snaps, pg->info.purged_snaps); + p.subtract(pg->info.purged_snaps); + pg->info.purged_snaps = info.purged_snaps; + if (!p.empty()) { + dout(10) << " purged_snaps " << pg->info.purged_snaps + << " -> " << info.purged_snaps + << " removed " << p << dendl; + pg->adjust_local_snaps(*t, p); } } + + pg->write_info(*t); + + if (!log.empty()) { + dout(10) << *pg << ": inactive replica merging new PG log entries" << dendl; + pg->merge_log(*t, info, log, from); + } } int tr = store->queue_transaction(&pg->osr, t, new ObjectStore::C_DeleteTransaction(t), fin);