Don't evict connections to achieve min_pool_size#648
Conversation
…ction limits before creating new connections to ensure the pool has a minimum size. This should prevent us from evicting older idle connections unnecessarily if the max connection limit for the user or db has been reached.
|
I wonder whether a different way of structuring this might be possible. I don't like that we have to repeat the whole logic of checking the parameters in your The tests are nice, but they each add >=7 seconds to the total run time, which seems quite a lot. Is there a way to get that shorter? |
1) removed check_max_connection_limits and instead added a new parameter to launch_new_connection that allows eviction behavior to be turned on/off. 2) adjust tests to run with sleep value of 1s instead of 7s. Also I was able to rerun the adjusted tests against pgbouncer built from master and confirm the tests failed (this detecting the issue).
|
Hi Peter, thanks for the review! I have modified the PR to use your suggested approach (new parameter to Also I adjusted the tests parameters so they would only need a sleep wait of 1 second. I confirmed that the new tests fail using a pgbouncer built before my changes (thus they are able to detect the issue). |
This should prevent us from evicting older idle connections unnecessarily if the max connection limit for the user or db has been reached.
This should address issue: #647
I have ran
test/test.shand all tests are passing (including two newly added ones).I have also tested locally reverting the checks I added to janitor and verified that the newly added tests fail.