]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: resend ops in the last_force_op_resend epoch
authorSage Weil <sage@inktank.com>
Thu, 8 May 2014 17:52:11 +0000 (10:52 -0700)
committerSage Weil <sage@inktank.com>
Mon, 19 May 2014 20:53:58 +0000 (13:53 -0700)
If we are a client, and process a map that sets last_force_op_resend to
the current epoch, force a resend of this op.

If the OSD expects us to do this, it will discard our previous op.  If the
OSD is old, it will process the old one, this will appear as a dup, and we
are no worse off than before.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit dd700bdf7115223cb3e517b851f462d75dd76a2b)

src/osdc/Objecter.cc

index 9da65b062c72abdfd70e928bd28efa028684b55a..9af742ef91b4e8eaca0c76a8fdbdf6e500312103 100644 (file)
@@ -1437,19 +1437,23 @@ int Objecter::calc_target(op_target_t *t)
   bool is_read = t->flags & CEPH_OSD_FLAG_READ;
   bool is_write = t->flags & CEPH_OSD_FLAG_WRITE;
 
+  const pg_pool_t *pi = osdmap->get_pg_pool(t->base_oloc.pool);
+  bool force_resend = false;
   bool need_check_tiering = false;
-  if (t->target_oid.name.empty()) {
+  if (pi && osdmap->get_epoch() == pi->last_force_op_resend) {
+    force_resend = true;
+  }
+  if (t->target_oid.name.empty() || force_resend) {
     t->target_oid = t->base_oid;
     need_check_tiering = true;
   }
-  if (t->target_oloc.empty()) {
+  if (t->target_oloc.empty() || force_resend) {
     t->target_oloc = t->base_oloc;
     need_check_tiering = true;
   }
   
   if (need_check_tiering &&
       (t->flags & CEPH_OSD_FLAG_IGNORE_OVERLAY) == 0) {
-    const pg_pool_t *pi = osdmap->get_pg_pool(t->base_oloc.pool);
     if (pi) {
       if (is_read && pi->has_read_tier())
        t->target_oloc.pool = pi->read_tier;
@@ -1485,7 +1489,8 @@ int Objecter::calc_target(op_target_t *t)
   }
 
   if (t->pgid != pgid ||
-      is_pg_changed(t->primary, t->acting, primary, acting, t->used_replica)) {
+      is_pg_changed(t->primary, t->acting, primary, acting, t->used_replica) ||
+      force_resend) {
     t->pgid = pgid;
     t->acting = acting;
     t->primary = primary;