diff options
author | Samuel Just <sam.just@inktank.com> | 2013-07-18 19:26:02 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-24 16:20:35 -0700 |
commit | 2f7979d1262e9d4899be76963a1620db46b334e8 (patch) | |
tree | fcff775fd07afd92ff4dc3ee407fdff7bdd20bea | |
parent | c7e2945a42541f966017180684dd969389eef3ac (diff) | |
download | ceph-2f7979d1262e9d4899be76963a1620db46b334e8.tar.gz |
ReplicatedPG: track temp collection contents, clear during on_change
We also assert in on_flushed() that the temp collection is actually
empty.
Fixes: #5670
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 47516d9c4b7f023f3a16e166749fa7b1c7b3b24c)
Conflicts:
src/osd/ReplicatedPG.cc
-rw-r--r-- | src/osd/ReplicatedPG.cc | 26 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.h | 3 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 736da8b3bbb..7acbca323b8 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -5260,6 +5260,9 @@ void ReplicatedPG::submit_push_data( ObjectStore::Transaction *t) { if (first) { + dout(10) << __func__ << ": Creating oid " + << recovery_info.soid << " in the temp collection" << dendl; + temp_contents.insert(recovery_info.soid); missing.revise_have(recovery_info.soid, eversion_t()); remove_snap_mapped_object(*t, recovery_info.soid); t->remove(get_temp_coll(t), recovery_info.soid); @@ -5287,6 +5290,10 @@ void ReplicatedPG::submit_push_complete(ObjectRecoveryInfo &recovery_info, ObjectStore::Transaction *t) { remove_snap_mapped_object(*t, recovery_info.soid); + assert(temp_contents.count(recovery_info.soid)); + dout(10) << __func__ << ": Removing oid " + << recovery_info.soid << " from the temp collection" << dendl; + temp_contents.erase(recovery_info.soid); t->collection_move(coll, get_temp_coll(t), recovery_info.soid); for (map<hobject_t, interval_set<uint64_t> >::const_iterator p = recovery_info.clone_subset.begin(); @@ -6315,6 +6322,15 @@ void ReplicatedPG::on_shutdown() void ReplicatedPG::on_flushed() { assert(object_contexts.empty()); + if (have_temp_coll() && + !osd->store->collection_empty(get_temp_coll())) { + vector<hobject_t> objects; + osd->store->collection_list(get_temp_coll(), objects); + derr << __func__ << ": found objects in the temp collection: " + << objects << ", crashing now" + << dendl; + assert(0 == "found garbage in the temp collection"); + } } void ReplicatedPG::on_activate() @@ -6365,6 +6381,16 @@ void ReplicatedPG::on_change(ObjectStore::Transaction *t) pulling.clear(); pull_from_peer.clear(); + // clear temp + for (set<hobject_t>::iterator i = temp_contents.begin(); + i != temp_contents.end(); + ++i) { + dout(10) << __func__ << ": Removing oid " + << *i << " from the temp collection" << dendl; + t->remove(get_temp_coll(t), *i); + } + temp_contents.clear(); + // clear snap_trimmer state snap_trimmer_machine.process_event(Reset()); diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 6bba4c57595..5b989442305 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -545,6 +545,9 @@ protected: }; map<hobject_t, PullInfo> pulling; + // Track contents of temp collection, clear on reset + set<hobject_t> temp_contents; + ObjectRecoveryInfo recalc_subsets(const ObjectRecoveryInfo& recovery_info); static void trim_pushed_data(const interval_set<uint64_t> ©_subset, const interval_set<uint64_t> &intervals_received, |