diff options
author | Sage Weil <sage@inktank.com> | 2013-02-11 06:23:54 -0800 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2013-03-19 10:30:21 -0700 |
commit | d6e678a62950ccc16d010a76500705e176ba9c73 (patch) | |
tree | 9743123aaf6309197dd013ba26eb028ac8c32f4f | |
parent | 51c2c4d7ccb25617967689d7e531eb145ee7011d (diff) | |
download | ceph-d6e678a62950ccc16d010a76500705e176ba9c73.tar.gz |
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 <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 31e911b63d326bdd06981ec4029ad71b7479ed70)
-rw-r--r-- | src/osd/PG.cc | 3 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.cc | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 1d90399b28c..23f1623d7fe 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2912,9 +2912,6 @@ void PG::update_snap_collections(vector<pg_log_entry_t> &log_entries, for (vector<pg_log_entry_t>::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<snapid_t> snaps; bufferlist::iterator p = i->snaps.begin(); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 3e75fe2c7dc..5a27ea4a8ae 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); |