summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-09-04 17:07:19 -0700
committerSage Weil <sage@inktank.com>2013-09-11 15:56:12 -0700
commit155cdd29a332339f5a1da65b2d8b4ad589393b41 (patch)
treedaa42e218b862e786b571ff398038f1ef1d4a4de
parentc4260fad291efe78da3d0a51cdd035ff947e3536 (diff)
downloadceph-155cdd29a332339f5a1da65b2d8b4ad589393b41.tar.gz
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 <sage@inktank.com>
-rw-r--r--src/messages/MOSDSubOp.h12
-rw-r--r--src/osd/ReplicatedPG.cc14
-rw-r--r--src/osd/ReplicatedPG.h2
3 files changed, 27 insertions, 1 deletions
diff --git a/src/messages/MOSDSubOp.h b/src/messages/MOSDSubOp.h
index 50b1a926957..4169e01325e 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 6b327744e05..677e9fb6a48 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 526a1907d16..f80be1b9391 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);