]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/Pipe: add option to restrict delay injection to specific msg type
authorJosh Durgin <josh.durgin@inktank.com>
Thu, 6 Feb 2014 01:22:14 +0000 (17:22 -0800)
committerJosh Durgin <josh.durgin@inktank.com>
Mon, 10 Feb 2014 23:45:38 +0000 (15:45 -0800)
This makes it possible to test timeouts reliably by delaying certain
messages effectively forever, but still being able to e.g. connect and
authenticate to the monitors.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
(cherry picked from commit d389e617c1019e44848330bf9570138ac7b0e5d4)

src/common/config_opts.h
src/msg/Pipe.cc

index f4dc28756184aa04ba936708865a23bb6e2a7f8a..312409296617238305a73d28de787d95152f6a6d 100644 (file)
@@ -119,6 +119,7 @@ OPTION(ms_pq_max_tokens_per_priority, OPT_U64, 4194304)
 OPTION(ms_pq_min_cost, OPT_U64, 65536)
 OPTION(ms_inject_socket_failures, OPT_U64, 0)
 OPTION(ms_inject_delay_type, OPT_STR, "")          // "osd mds mon client" allowed
+OPTION(ms_inject_delay_msg_type, OPT_STR, "")      // the type of message to delay, as returned by Message::get_type_name(). This is an additional restriction on the general type filter ms_inject_delay_type.
 OPTION(ms_inject_delay_max, OPT_DOUBLE, 1)         // seconds
 OPTION(ms_inject_delay_probability, OPT_DOUBLE, 0) // range [0, 1]
 OPTION(ms_inject_internal_delays, OPT_DOUBLE, 0)   // seconds
index 6f271c812f386324e27f96e60ab8616c813e05d5..bdfc89fe7c8b37a940b7417ce7a6c5a0934f637f 100644 (file)
@@ -193,12 +193,14 @@ void *Pipe::DelayedDelivery::entry()
       continue;
     }
     utime_t release = delay_queue.front().first;
-    if (release > ceph_clock_now(pipe->msgr->cct)) {
+    Message *m = delay_queue.front().second;
+    string delay_msg_type = pipe->msgr->cct->_conf->ms_inject_delay_msg_type;
+    if (release > ceph_clock_now(pipe->msgr->cct) &&
+       (delay_msg_type.empty() || m->get_type_name() == delay_msg_type)) {
       lgeneric_subdout(pipe->msgr->cct, ms, 10) << pipe->_pipe_prefix(_dout) << "DelayedDelivery::entry sleeping on delay_cond until " << release << dendl;
       delay_cond.WaitUntil(delay_lock, release);
       continue;
     }
-    Message *m = delay_queue.front().second;
     lgeneric_subdout(pipe->msgr->cct, ms, 10) << pipe->_pipe_prefix(_dout) << "DelayedDelivery::entry dequeuing message " << m << " for delivery, past " << release << dendl;
     delay_queue.pop_front();
     pipe->in_q->enqueue(m, m->get_priority(), pipe->conn_id);