From dabab543cce796449714023644469858f29f16c5 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 17 Sep 2019 14:45:53 +0300 Subject: [PATCH] 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. --- server/core/dcb.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/core/dcb.cc b/server/core/dcb.cc index c9af9a270..4b1f4f615 100644 --- a/server/core/dcb.cc +++ b/server/core/dcb.cc @@ -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