From dcf9a4a3623682441cdc30e544be3442e881312b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sun, 29 Jan 2023 22:23:55 +0000 Subject: [PATCH] mysql_hostgroup_attributes.throttle_connections_per_sec Implementation of mysql_hostgroup_attributes.throttle_connections_per_sec If mysql_hostgroup_attributes is configured, mysql_hostgroup_attributes.throttle_connections_per_sec has higher priority than global variable mysql-throttle_connections_per_sec_to_hostgroup --- lib/MySQL_HostGroups_Manager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 703254f51..c607d34af 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -3169,7 +3169,12 @@ MySQL_Connection * MySrvConnList::get_random_MyConn(MySQL_Session *sess, bool ff _myhgc->new_connections_now = 0; } _myhgc->new_connections_now++; - if (_myhgc->new_connections_now > (unsigned int) mysql_thread___throttle_connections_per_sec_to_hostgroup) { + unsigned int throttle_connections_per_sec_to_hostgroup = (unsigned int) mysql_thread___throttle_connections_per_sec_to_hostgroup; + if (_myhgc->attributes.configured == true) { + // mysql_hostgroup_attributes takes priority + throttle_connections_per_sec_to_hostgroup = _myhgc->attributes.throttle_connections_per_sec; + } + if (_myhgc->new_connections_now > (unsigned int) throttle_connections_per_sec_to_hostgroup) { __sync_fetch_and_add(&MyHGM->status.server_connections_delayed, 1); return NULL; } else {