]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osdc/Objecter: populate both actual pgid and full has in MOSDOp
authorSage Weil <sage@redhat.com>
Fri, 3 Feb 2017 21:06:28 +0000 (16:06 -0500)
committerSage Weil <sage@redhat.com>
Tue, 14 Feb 2017 04:03:50 +0000 (23:03 -0500)
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 <sage@redhat.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 400f1c92d125061a8011207b7371e9fabda98a90..2b2113f73a8c19ce99a284ac81c08575274ea863 100644 (file)
@@ -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;
index 7946f949915080a7225ce422b31edf89dddd67ca..58295094921941544ed13588c3c0c958eed9fc31 100644 (file)
@@ -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<int> up; ///< set of up osds for last pg we mapped to