diff options
author | Sage Weil <sage@inktank.com> | 2013-09-03 15:41:14 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-09-11 15:19:18 -0700 |
commit | c9885e7487953a3bde7dcce12443eafbb000e2d4 (patch) | |
tree | 7e62c9a53ef5a174ad908b03ed33f083d8e4146f | |
parent | 6cecd0db5686bd32cd3050bb7ed2558f2db117e8 (diff) | |
download | ceph-c9885e7487953a3bde7dcce12443eafbb000e2d4.tar.gz |
osd/ReplicatedPG: generate one-off unique temp object names
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/osd/ReplicatedPG.cc | 14 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.h | 6 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index b391e173d14..abe28366a7d 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -50,6 +50,7 @@ #include "include/compat.h" #include "common/cmdparse.h" +#include "mon/MonClient.h" #include "osdc/Objecter.h" #include "json_spirit/json_spirit_value.h" @@ -622,7 +623,9 @@ ReplicatedPG::ReplicatedPG(OSDService *o, OSDMapRef curmap, PG(o, curmap, _pool, p, oid, ioid), snapset_contexts_lock("ReplicatedPG::snapset_contexts"), temp_created(false), - temp_coll(coll_t::make_temp_coll(p)), snap_trimmer_machine(this) + temp_coll(coll_t::make_temp_coll(p)), + temp_seq(0), + snap_trimmer_machine(this) { snap_trimmer_machine.initiate(); } @@ -3935,6 +3938,15 @@ coll_t ReplicatedPG::get_temp_coll(ObjectStore::Transaction *t) return temp_coll; } +hobject_t ReplicatedPG::generate_temp_object() +{ + ostringstream ss; + ss << "temp_" << info.pgid << "_" << get_role() << "_" << osd->monc->get_global_id() << "_" << (++temp_seq); + hobject_t hoid(object_t(ss.str()), "", CEPH_NOSNAP, 0, -1, ""); + dout(20) << __func__ << " " << hoid << dendl; + return hoid; +} + int ReplicatedPG::prepare_transaction(OpContext *ctx) { assert(!ctx->ops.empty()); diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 254b5842ffc..afd04c9ac9f 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -419,9 +419,6 @@ 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, @@ -852,7 +849,10 @@ public: private: bool temp_created; coll_t temp_coll; + set<hobject_t> temp_contents; ///< contents of temp collection, clear on reset + uint64_t temp_seq; ///< last id for naming temp objects coll_t get_temp_coll(ObjectStore::Transaction *t); + hobject_t generate_temp_object(); ///< generate a new temp object name public: bool have_temp_coll(); coll_t get_temp_coll() { |