forked from rails/rails
-
Notifications
You must be signed in to change notification settings - Fork 1
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
ChaelCodes
wants to merge
24
commits into
matthewd:impeller
Choose a base branch
from
ChaelCodes:volute-3
base: impeller
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Co-authored-by: Chris AtLee <[email protected]>
Co-authored-by: Chris AtLee <[email protected]>
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.
…ctions Co-authored-by: Matthew Draper <[email protected]>
Co-authored-by: Matthew Draper <[email protected]>
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.
of connection_pool_test.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Background
The connection pools (or at least their config) seem to be shared between tests. A low
idle_timeout
and therefore a lowreaping_frequency
is causing some async tests to fail.Detail
This Pull Request allows
reaping_frequency
to be set toidle_timeout
by:idle_timeout
so theidle_timeout
will be reset to a higher value after the test runsAdditional information
See experimental commits and test runs.
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]