]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
hobject_t/ReplicatedPG: tempness is now an hobject thing
authorSamuel Just <sam.just@inktank.com>
Thu, 10 Oct 2013 23:10:36 +0000 (16:10 -0700)
committerSamuel Just <sam.just@inktank.com>
Wed, 22 Jan 2014 22:39:15 +0000 (14:39 -0800)
PGBackend implmentations will have complete control over the temp
collection.  Rather than specifying the collection when sending
ops into the PGBackend, hobjects themselves will be temp or not.

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/common/hobject.h
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 171375457836ab089a4fe7edda68e6293ed0fb82..48027a8e3b746c1ca35de7322964c618a14a6213 100644 (file)
@@ -35,6 +35,7 @@ struct hobject_t {
   uint32_t hash;
 private:
   bool max;
+  static const int64_t POOL_IS_TEMP = -1;
 public:
   int64_t pool;
   string nspace;
@@ -55,6 +56,14 @@ public:
   bool match(uint32_t bits, uint32_t match) const {
     return match_hash(hash, bits, match);
   }
+
+  static hobject_t make_temp(const string &name) {
+    hobject_t ret(object_t(name), "", CEPH_NOSNAP, 0, POOL_IS_TEMP, "");
+    return ret;
+  }
+  bool is_temp() const {
+    return pool == POOL_IS_TEMP;
+  }
   
   hobject_t() : snap(0), hash(0), max(false), pool(-1) {}
 
index f4a6f7c13d8fea92f35e2d9cec343ede26fdf911..0d02ea7e0c7a555b3648e48aa51bf05647f81be0 100644 (file)
@@ -4540,7 +4540,8 @@ 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, "");
+  hobject_t hoid = hobject_t::make_temp(ss.str());
+  // TODOSAM: adjust when this method gets absorbed into ReplicatedBackend
   pgbackend->add_temp_obj(hoid);
   dout(20) << __func__ << " " << hoid << dendl;
   return hoid;
@@ -5019,7 +5020,6 @@ void ReplicatedPG::process_copy_chunk(hobject_t oid, tid_t tid, int r)
     ObjectContextRef tempobc = get_object_context(cop->results.temp_oid, true);
     RepGather *repop = simple_repop_create(tempobc);
     if (cop->temp_cursor.is_initial()) {
-      cop->results.temp_coll = get_temp_coll(&repop->ctx->local_t);
       repop->ctx->new_temp_oid = cop->results.temp_oid;
     }
     _write_copy_chunk(cop, &repop->ctx->op_t);
@@ -5085,14 +5085,15 @@ void ReplicatedPG::_build_finish_copy_transaction(CopyOpRef cop,
 
   if (cop->temp_cursor.is_initial()) {
     // write directly to final object
-    cop->results.temp_coll = coll;
     cop->results.temp_oid = obs.oi.soid;
     _write_copy_chunk(cop, &t);
   } else {
     // finish writing to temp object, then move into place
     _write_copy_chunk(cop, &t);
-    t.collection_move_rename(cop->results.temp_coll, cop->results.temp_oid,
-                            coll, obs.oi.soid);
+    t.collection_move_rename(
+      cop->results.temp_coll, cop->results.temp_oid, coll, obs.oi.soid);
+
+    // TODOSAM: adjust when this method gets absorbed into ReplicatedBackend
     pgbackend->clear_temp_obj(cop->results.temp_oid);
   }
 }
@@ -5152,9 +5153,7 @@ void ReplicatedPG::finish_promote(int r, OpRequestRef op,
     dout(10) << __func__ << " abort; will clean up partial work" << dendl;
     ObjectContextRef tempobc = get_object_context(results->temp_oid, true);
     RepGather *repop = simple_repop_create(tempobc);
-    repop->ctx->op_t.remove(results->temp_coll, results->temp_oid);
-    repop->ctx->discard_temp_oid = results->temp_oid;
-    pgbackend->clear_temp_obj(results->temp_oid);
+    repop->ctx->op_t->remove(results->temp_oid);
     simple_repop_submit(repop);
     results->started_temp_obj = false;
   }
@@ -6663,11 +6662,13 @@ void ReplicatedPG::sub_op_modify(OpRequestRef op)
 
     if (m->new_temp_oid != hobject_t()) {
       dout(20) << __func__ << " start tracking temp " << m->new_temp_oid << dendl;
+      // TODOSAM: adjust when this method gets absorbed into ReplicatedBackend
       pgbackend->add_temp_obj(m->new_temp_oid);
       get_temp_coll(&rm->localt);
     }
     if (m->discard_temp_oid != hobject_t()) {
       dout(20) << __func__ << " stop tracking temp " << m->discard_temp_oid << dendl;
+      // TODOSAM: adjust when this method gets absorbed into ReplicatedBackend
       pgbackend->clear_temp_obj(m->discard_temp_oid);
     }
 
index bf31e6b542734fab46aaf3f53872e85b5b9e2b75..c921029aafc44061ec4d018dedbd55bf4a2b699f 100644 (file)
@@ -107,7 +107,6 @@ public:
     utime_t mtime; ///< the copy source's mtime
     uint64_t object_size; ///< the copied object's size
     bool started_temp_obj; ///< true if the callback needs to delete temp object
-    coll_t temp_coll;      ///< temp collection (if any)
     hobject_t temp_oid;    ///< temp object (if any)
     /**
      * Final transaction; if non-empty the callback must execute it before any