Skip to content

Commit

Permalink
Issue RedisLabs#204, Disable READ/WRITE events if no requests sent
Browse files Browse the repository at this point in the history
In cluster mode, where there are few requests with many shards, some
of the shards might not send any requests.

Currently, the memtier-benchmark is hang, because the connections
to these shards are not disabling their read/write events
  • Loading branch information
YaacovHazan committed May 17, 2023
1 parent a1821df commit a1edaa5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions shard_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,6 @@ void shard_connection::process_response(void)

fill_pipeline();

// update events
if (m_bev != NULL) {
// no pending response (nothing to read) and output buffer empty (nothing to write)
if ((m_pending_resp == 0) && (evbuffer_get_length(bufferevent_get_output(m_bev)) == 0)) {
bufferevent_disable(m_bev, EV_WRITE|EV_READ);
}
}

if (m_conns_manager->finished()) {
m_conns_manager->set_end_time();
}
Expand Down Expand Up @@ -508,6 +500,14 @@ void shard_connection::fill_pipeline(void)
// client manage requests logic
m_conns_manager->create_request(now, m_id);
}

// update events
if (m_bev != NULL) {
// no pending response (nothing to read) and output buffer empty (nothing to write)
if ((m_pending_resp == 0) && (evbuffer_get_length(bufferevent_get_output(m_bev)) == 0)) {
bufferevent_disable(m_bev, EV_WRITE|EV_READ);
}
}
}

void shard_connection::handle_event(short events)
Expand Down

0 comments on commit a1edaa5

Please sign in to comment.