From: Sage Weil Date: Fri, 3 Feb 2017 21:06:28 +0000 (-0500) Subject: osdc/Objecter: populate both actual pgid and full has in MOSDOp X-Git-Tag: v12.0.1~383^2~19 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3fd302cf812c56cf02da669b724e7f6c290ee83d;p=ceph-ci.git osdc/Objecter: populate both actual pgid and full has in MOSDOp New clients need the actual pgid as well as the full hash (as part of the target hobj). Old clients only use the full hash value. We need to pass both to MOSDOp so it can encode based on the target features. Signed-off-by: Sage Weil --- diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 400f1c92d12..2b2113f73a8 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -2777,9 +2777,14 @@ int Objecter::_calc_target(op_target_t *t, Connection *con, bool any_change) t->min_size = min_size; t->pg_num = pg_num; t->pg_num_mask = pi->get_pg_num_mask(); + osdmap->get_primary_shard( + pg_t(ceph_stable_mod(pgid.ps(), t->pg_num, t->pg_num_mask), pgid.pool()), + &t->actual_pgid); t->sort_bitwise = sort_bitwise; ldout(cct, 10) << __func__ << " " - << " pgid " << pgid << " acting " << acting << dendl; + << " pgid " << pgid << " -> " << t->actual_pgid + << " acting " << acting + << " primary " << acting_primary << dendl; t->used_replica = false; if (acting_primary == -1) { t->osd = -1; @@ -3035,9 +3040,9 @@ MOSDOp *Objecter::_prepare_osd_op(Op *op) op->target.paused = false; op->stamp = ceph::mono_clock::now(); + hobject_t hobj = op->target.get_hobj(); MOSDOp *m = new MOSDOp(client_inc.read(), op->tid, - op->target.target_oid, op->target.target_oloc, - op->target.pgid, + hobj, op->target.actual_pgid, osdmap->get_epoch(), flags, op->features); @@ -3094,7 +3099,16 @@ void Objecter::_send_op(Op *op, MOSDOp *m) m = _prepare_osd_op(op); } - ldout(cct, 15) << "_send_op " << op->tid << " to osd." << op->session->osd + if (op->target.actual_pgid != m->get_spg()) { + ldout(cct, 10) << __func__ << " " << op->tid << " pgid change from " + << m->get_spg() << " to " << op->target.actual_pgid + << ", updating and reencoding" << dendl; + m->set_spg(op->target.actual_pgid); + m->clear_payload(); // reencode + } + + ldout(cct, 15) << "_send_op " << op->tid << " to " + << op->target.actual_pgid << " on osd." << op->session->osd << dendl; ConnectionRef con = op->session->con; diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 7946f949915..58295094921 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1193,7 +1193,8 @@ public: ///< explcit pg target, if any pg_t base_pgid; - pg_t pgid; ///< last pg we mapped to + pg_t pgid; ///< last (raw) pg we mapped to + spg_t actual_pgid; ///< last (actual) spg_t we mapped to unsigned pg_num = 0; ///< last pg_num we mapped to unsigned pg_num_mask = 0; ///< last pg_num_mask we mapped to vector up; ///< set of up osds for last pg we mapped to