From: Josh Durgin Date: Wed, 18 May 2016 21:40:23 +0000 (-0700) Subject: Objecter: add option for testing osd dup handling X-Git-Tag: ses5-milestone5~413^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6faa449fc66752b71727f93b9846980b579e8f65;p=ceph.git Objecter: add option for testing osd dup handling Signed-off-by: Josh Durgin --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 10d91b4c010..24a31a18a40 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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) diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 017bffcc7ab..503f5cab0c8 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -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 " diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index e12106bce63..2e2022e4b4b 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -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); };