Skip to content

Commit 38b8ebe

Browse files
authored
Merge pull request #3640 from sysown/v2.3.2-3628
Fix bug 3628
2 parents 7937c42 + 86661be commit 38b8ebe

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lib/MySQL_HostGroups_Manager.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3548,8 +3548,22 @@ int MySQL_HostGroups_Manager::get_multiple_idle_connections(int _hid, unsigned l
35483548
drop_all_idle_connections();
35493549
int num_conn_current=0;
35503550
int j,k;
3551-
MyHGC* myhgc = MyHGC_find(_hid);
3552-
if (myhgc) {
3551+
MyHGC* myhgc = NULL;
3552+
for (int i=0; i<(int)MyHostGroups->len; i++) {
3553+
if (_hid == -1) {
3554+
// all hostgroups must be examined
3555+
// as of version 2.3.2 , this is always the case
3556+
myhgc=(MyHGC *)MyHostGroups->index(i);
3557+
} else {
3558+
// only one hostgroup is examined
3559+
// as of version 2.3.2 , this never happen
3560+
// but the code support this functionality
3561+
myhgc = MyHGC_find(_hid);
3562+
i = (int)MyHostGroups->len; // to exit from this "for" loop
3563+
if (myhgc == NULL)
3564+
continue; // immediately exit
3565+
}
3566+
if (_hid >= 0 && _hid!=(int)myhgc->hid) continue;
35533567
for (j=0; j<(int)myhgc->mysrvs->cnt(); j++) {
35543568
MySrvC *mysrvc=(MySrvC *)myhgc->mysrvs->servers->index(j);
35553569
//PtrArray *pa=mysrvc->ConnectionsFree->conns;

0 commit comments

Comments
 (0)