From: Sage Weil Date: Mon, 11 Feb 2013 14:23:54 +0000 (-0800) Subject: osd: update snap collections for sub_op_modify log records conditionaly X-Git-Tag: v0.56.4~27 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d6e678a62950ccc16d010a76500705e176ba9c73;p=ceph.git osd: update snap collections for sub_op_modify log records conditionaly The only remaining caller is sub_op_modify(). If we do have a non-empty op transaction, we want to do this update, regardless of what we think last_backfill is (our notion may be not completely in sync with the primary). In particular, our last_backfill may be the same object but a different snapid, but the primary disagrees and is pushing an op transaction through. Instead, update the collections if we have a non-empty transaction. Signed-off-by: Sage Weil Reviewed-by: Samuel Just (cherry picked from commit 31e911b63d326bdd06981ec4029ad71b7479ed70) --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 1d90399b28cd..23f1623d7fea 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2912,9 +2912,6 @@ void PG::update_snap_collections(vector &log_entries, for (vector::iterator i = log_entries.begin(); i != log_entries.end(); ++i) { - // If past backfill line, snap_collections will be updated during push - if (i->soid > info.last_backfill) - continue; if (i->snaps.length() > 0) { vector snaps; bufferlist::iterator p = i->snaps.begin(); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 3e75fe2c7dca..5a27ea4a8ae1 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4661,7 +4661,13 @@ void ReplicatedPG::sub_op_modify(OpRequestRef op) } info.stats = m->pg_stats; - update_snap_collections(log, rm->localt); + if (!rm->opt.empty()) { + // If the opt is non-empty, we infer we are before + // last_backfill (according to the primary, not our + // not-quite-accurate value), and should update the + // collections now. Otherwise, we do it later on push. + update_snap_collections(log, rm->localt); + } append_log(log, m->pg_trim_to, rm->localt); rm->tls.push_back(&rm->localt);