Fix a bug in get_multiple_idle_connections() #3628

2.3.0 introduces a bug that prevents proxysql to run ping on backend
connections to keep them alive.
v2.x-keep_multiplexing_regression_fix
René Cannaò 5 years ago
parent 06c386dfd1
commit fb8857f1fe

@ -3548,8 +3548,22 @@ int MySQL_HostGroups_Manager::get_multiple_idle_connections(int _hid, unsigned l
drop_all_idle_connections();
int num_conn_current=0;
int j,k;
MyHGC* myhgc = MyHGC_find(_hid);
if (myhgc) {
MyHGC* myhgc = NULL;
for (int i=0; i<(int)MyHostGroups->len; i++) {
if (_hid == -1) {
// all hostgroups must be examined
// as of version 2.3.2 , this is always the case
myhgc=(MyHGC *)MyHostGroups->index(i);
} else {
// only one hostgroup is examined
// as of version 2.3.2 , this never happen
// but the code support this functionality
myhgc = MyHGC_find(_hid);
i = (int)MyHostGroups->len; // to exit from this "for" loop
if (myhgc == NULL)
continue; // immediately exit
}
if (_hid >= 0 && _hid!=(int)myhgc->hid) continue;
for (j=0; j<(int)myhgc->mysrvs->cnt(); j++) {
MySrvC *mysrvc=(MySrvC *)myhgc->mysrvs->servers->index(j);
//PtrArray *pa=mysrvc->ConnectionsFree->conns;

Loading…
Cancel
Save