From: Sage Weil Date: Thu, 5 Sep 2013 00:07:19 +0000 (-0700) Subject: osd: flag new/old temp objects in MOSDSubOp X-Git-Tag: v0.71~119^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=155cdd29a332339f5a1da65b2d8b4ad589393b41;p=ceph.git osd: flag new/old temp objects in MOSDSubOp Allow us to mark when we start and stop using a temporary object in a sub_op. If we start to use it, make sure the collection exists on the replica. Signed-off-by: Sage Weil --- diff --git a/src/messages/MOSDSubOp.h b/src/messages/MOSDSubOp.h index 50b1a9269572..4169e01325e2 100644 --- a/src/messages/MOSDSubOp.h +++ b/src/messages/MOSDSubOp.h @@ -25,7 +25,7 @@ class MOSDSubOp : public Message { - static const int HEAD_VERSION = 7; + static const int HEAD_VERSION = 8; static const int COMPAT_VERSION = 1; public: @@ -86,6 +86,9 @@ public: // indicates that we must fix hobject_t encoding bool hobject_incorrect_pool; + hobject_t new_temp_oid; ///< new temp object that we must now start tracking + hobject_t discard_temp_oid; ///< previously used temp object that we can now stop tracking + int get_cost() const { if (ops.size() == 1 && ops[0].op.op == CEPH_OSD_OP_PULL) return ops[0].op.extent.length; @@ -150,6 +153,11 @@ public: poid.pool = pgid.pool(); hobject_incorrect_pool = true; } + + if (header.version >= 8) { + ::decode(new_temp_oid, p); + ::decode(discard_temp_oid, p); + } } virtual void encode_payload(uint64_t features) { @@ -194,6 +202,8 @@ public: ::encode(current_progress, payload); ::encode(omap_entries, payload); ::encode(omap_header, payload); + ::encode(new_temp_oid, payload); + ::encode(discard_temp_oid, payload); } MOSDSubOp() diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 6b327744e05f..677e9fb6a483 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4578,6 +4578,10 @@ void ReplicatedPG::issue_repop(RepGather *repop, utime_t now) wr->pg_stats = info.stats; wr->pg_trim_to = pg_trim_to; + + wr->new_temp_oid = repop->ctx->new_temp_oid; + wr->discard_temp_oid = repop->ctx->discard_temp_oid; + osd->send_message_osd_cluster(peer, wr, get_osdmap()->get_epoch()); // keep peer_info up to date @@ -5175,6 +5179,16 @@ void ReplicatedPG::sub_op_modify(OpRequestRef op) bufferlist::iterator p = m->get_data().begin(); + if (m->new_temp_oid != hobject_t()) { + dout(20) << __func__ << " start tracking temp " << m->new_temp_oid << dendl; + temp_contents.insert(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; + temp_contents.erase(m->discard_temp_oid); + } + ::decode(rm->opt, p); if (!(m->get_connection()->get_features() & CEPH_FEATURE_OSD_SNAPMAPPER)) rm->opt.set_tolerate_collection_add_enoent(); diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 526a1907d16d..f80be1b93919 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -180,6 +180,8 @@ public: CopyOpRef copy_op; + hobject_t new_temp_oid, discard_temp_oid; ///< temp objects we should start/stop tracking + OpContext(const OpContext& other); const OpContext& operator=(const OpContext& other);