@@ -113,6 +113,7 @@ typedef struct SessionPool
113
113
Channel * pending_clients ; /* List of clients waiting for free backend */
114
114
Proxy * proxy ; /* Owner of this pool */
115
115
int n_launched_backends ; /* Total number of launched backends */
116
+ int n_dedicated_backends ;/* Number of dedicated (tainted) backends */
116
117
int n_idle_backends ; /* Number of backends in idle state */
117
118
int n_connected_clients ; /* Total number of connected clients */
118
119
int n_idle_clients ; /* Number of clients in idle state */
@@ -208,6 +209,7 @@ backend_reschedule(Channel* chan, bool is_new)
208
209
ELOG (LOG , "Backed %d is tainted" , chan -> backend_pid );
209
210
chan -> backend_is_tainted = true;
210
211
chan -> proxy -> state -> n_dedicated_backends += 1 ;
212
+ chan -> pool -> n_dedicated_backends += 1 ;
211
213
}
212
214
return true;
213
215
}
@@ -357,7 +359,7 @@ client_connect(Channel* chan, int startup_packet_size)
357
359
* Use then for launching pooler worker backends and report error
358
360
* if GUCs in startup packets are different.
359
361
*/
360
- if (chan -> pool -> n_launched_backends == 0 )
362
+ if (chan -> pool -> n_launched_backends == chan -> pool -> n_dedicated_backends )
361
363
{
362
364
list_free (chan -> pool -> startup_gucs );
363
365
if (chan -> pool -> cmdline_options )
@@ -372,7 +374,7 @@ client_connect(Channel* chan, int startup_packet_size)
372
374
if (!string_list_equal (chan -> pool -> startup_gucs , chan -> client_port -> guc_options ) ||
373
375
!string_equal (chan -> pool -> cmdline_options , chan -> client_port -> cmdline_options ))
374
376
{
375
- elog (LOG , "Ignoring GUCs of client %s" ,
377
+ elog (LOG , "Ignoring startup GUCs of client %s" ,
376
378
NULLSTR (chan -> client_port -> application_name ));
377
379
}
378
380
}
@@ -1087,6 +1089,7 @@ channel_remove(Channel* chan)
1087
1089
{
1088
1090
chan -> proxy -> state -> n_backends -= 1 ;
1089
1091
chan -> proxy -> state -> n_dedicated_backends -= chan -> backend_is_tainted ;
1092
+ chan -> pool -> n_dedicated_backends -= chan -> backend_is_tainted ;
1090
1093
chan -> pool -> n_launched_backends -= 1 ;
1091
1094
closesocket (chan -> backend_socket );
1092
1095
pfree (chan -> handshake_response );
0 commit comments