]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Objecter: add option for testing osd dup handling
authorJosh Durgin <jdurgin@redhat.com>
Wed, 18 May 2016 21:40:23 +0000 (14:40 -0700)
committerJosh Durgin <jdurgin@redhat.com>
Sat, 9 Jul 2016 01:33:14 +0000 (18:33 -0700)
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
src/common/config_opts.h
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 10d91b4c0107be1ad042ac71733e94de69b13789..24a31a18a40101b7f6fd47f07a1e2bca5d3068cb 100644 (file)
@@ -429,6 +429,7 @@ OPTION(objecter_inflight_op_bytes, OPT_U64, 1024*1024*100) // max in-flight data
 OPTION(objecter_inflight_ops, OPT_U64, 1024)               // max in-flight ios
 OPTION(objecter_completion_locks_per_session, OPT_U64, 32) // num of completion locks per each session, for serializing same object responses
 OPTION(objecter_inject_no_watch_ping, OPT_BOOL, false)   // suppress watch pings
+OPTION(objecter_retry_writes_after_first_reply, OPT_BOOL, false)   // ignore the first reply for each write, and resend the osd op instead
 
 // Max number of deletes at once in a single Filer::purge call
 OPTION(filer_max_purge_ops, OPT_U32, 10)
index 017bffcc7ab21a342833e96dfd7f1b05619326de..503f5cab0c83e7b965c26509d368a584cb0a8b3a 100644 (file)
@@ -3215,6 +3215,24 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m)
                << dendl;
   Op *op = iter->second;
 
+  if (retry_writes_after_first_reply && op->attempts == 1 &&
+      (op->target.flags & CEPH_OSD_FLAG_WRITE)) {
+    ldout(cct, 7) << "retrying write after first reply: " << tid << dendl;
+    if (op->onack) {
+      num_unacked.dec();
+    }
+    if (op->oncommit || op->oncommit_sync) {
+      num_uncommitted.dec();
+    }
+    _session_op_remove(s, op);
+    sl.unlock();
+    put_session(s);
+
+    _op_submit(op, sul, NULL);
+    m->put();
+    return;
+  }
+
   if (m->get_retry_attempt() >= 0) {
     if (m->get_retry_attempt() != (op->attempts - 1)) {
       ldout(cct, 7) << " ignoring reply from attempt "
index e12106bce63c2425e4bb1c32cc9e7d3117aa96bf..2e2022e4b4b60643cd58b2eccaef974e82eaca04 100644 (file)
@@ -1951,7 +1951,8 @@ private:
     op_throttle_bytes(cct, "objecter_bytes",
                      cct->_conf->objecter_inflight_op_bytes),
     op_throttle_ops(cct, "objecter_ops", cct->_conf->objecter_inflight_ops),
-    epoch_barrier(0)
+    epoch_barrier(0),
+    retry_writes_after_first_reply(cct->_conf->objecter_retry_writes_after_first_reply)
   { }
   ~Objecter();
 
@@ -2936,6 +2937,7 @@ public:
 
 private:
   epoch_t epoch_barrier;
+  bool retry_writes_after_first_reply;
 public:
   void set_epoch_barrier(epoch_t epoch);
 };