Skip to content

Fix issues with idle_timeout in connection_pool_test #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: impeller
Choose a base branch
from

Conversation

ChaelCodes
Copy link

Motivation / Background

The connection pools (or at least their config) seem to be shared between tests. A low idle_timeout and therefore a low reaping_frequency is causing some async tests to fail.

Detail

This Pull Request allows reaping_frequency to be set to idle_timeout by:

  • raising the idle_timeout in connection_pool_test where possible
  • reordering the idle_timeout tests that require a low idle_timeout so the idle_timeout will be reset to a higher value after the test runs

Additional information

See experimental commits and test runs.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

matthewd and others added 24 commits February 20, 2025 00:08
We should still avoid using them whenever possible, but e.g. I'd like to
be able to break connections inside a pool test.
The shared setup method creates a connection pool, and having the
isolation level change after a pool is created makes things awkward.

This has slightly more duplication, but not enough that I feel the need
to seek a different abstraction.
In the process, be more consistent about always disconnecting pools
we've created.
Building upon the "checkout for maintenance" primitives, this gives us a
method to progressively loop over idle connections without the risk of
starving the pool while we work.

Even for something internal, I don't love the API... but hopefully it
will suffice until we come up with something better.
Optionally ensure the full database connection chain sees regular query
traffic (without affecting our internal idle counters).
Avoid using database connections that were originally established over
the configured duration ago. This can be helpful to provide smooth
failover between connection proxies.
This is ideal where the caller knows that a database server/proxy
failover is occurring (meaning that previously-established connections
are now potentially pointing to the wrong place, and new fresh
connections will go to the right one); where such signalling is
possible, it can be used in place of an onerously low / "preventative"
max_age.
It's less elegant, but just seems easier to reason about.
For each connection, we'll reduce both values by up to 20% (by default),
preventing repeated thundering herds.

Co-authored-by: ChaelCodes <[email protected]>
Lower the baseline to 20s, but also reduce it further if that's needed
in order to usefully achieve one of our configured timeouts.

Co-authored-by: ChaelCodes <[email protected]>
idle_timeout is leaking into other tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants