MXS-2684 Add throttling callbacks to backend DCB from pool

Add throttling callbacks to a backend DCB taken from the persistent
pool. They were removed when the dcb was put into the pool.
This commit is contained in:
Johan Wikman 2019-09-17 14:45:53 +03:00
parent 60c33b149c
commit dabab543cc

View File

@ -411,6 +411,12 @@ DCB* dcb_connect(SERVER* server, MXS_SESSION* session, const char* protocol)
dcb->was_persistent = true;
dcb->last_read = mxs_clock();
mxb::atomic::add(&server->stats.n_from_pool, 1, mxb::atomic::RELAXED);
/* All callbacks were removed when the dcb was put into the pool. */
if (DCB_THROTTLING_ENABLED(dcb))
{
dcb_add_callback(dcb, DCB_REASON_HIGH_WATER, upstream_throttle_callback, NULL);
dcb_add_callback(dcb, DCB_REASON_LOW_WATER, upstream_throttle_callback, NULL);
}
return dcb;
}
else