msg/simple/DispatchQueue: inject internal delays in special event dispatch

E.g., connection reset.  This will help uncover subtle races.

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2016-04-14 13:01:36 -04:00
parent c04fd4210f
commit df4e134334

View File

@ -150,6 +150,15 @@ void DispatchQueue::entry()
lock.Unlock();
if (qitem.is_code()) {
if (cct->_conf->ms_inject_internal_delays &&
cct->_conf->ms_inject_delay_probability &&
(rand() % 10000)/10000.0 < cct->_conf->ms_inject_delay_probability) {
utime_t t;
t.set_from_double(cct->_conf->ms_inject_internal_delays);
ldout(cct, 1) << "DispatchQueue::entry inject delay of " << t
<< dendl;
t.sleep();
}
switch (qitem.get_code()) {
case D_BAD_REMOTE_RESET:
msgr->ms_deliver_handle_remote_reset(qitem.get_connection());