]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: generate one-off unique temp object names
authorSage Weil <sage@inktank.com>
Tue, 3 Sep 2013 22:41:14 +0000 (15:41 -0700)
committerSage Weil <sage@inktank.com>
Wed, 11 Sep 2013 22:19:18 +0000 (15:19 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index b391e173d148afc48b19d2a5e86db41493b51539..abe28366a7d655a4112d62db42aa535b325d0482 100644 (file)
@@ -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());
index 254b5842ffce90050627f69ceeae51d59f416bc2..afd04c9ac9fd59be8a2e94a7e4c50452fd3ff55d 100644 (file)
@@ -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> &copy_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() {