Skip to content

Commit

Permalink
mysql_hostgroup_attributes.throttle_connections_per_sec
Browse files Browse the repository at this point in the history
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
  • Loading branch information
renecannao committed Jan 29, 2023
1 parent 7b00d05 commit dcf9a4a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/MySQL_HostGroups_Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit dcf9a4a

Please sign in to comment.