Skip to content
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

Prevent overriding default rails connection_specification_name ("primary") #32

Merged
merged 2 commits into from
Jan 14, 2020

Conversation

aqeelvn
Copy link

@aqeelvn aqeelvn commented Apr 27, 2018

Fixes #31

Rails 5.2.0 introduced a change via rails/rails@0bd7f4a which reuses a connection object created before migration after migration. Because `reconnect_with_percona` does a new `establish_connection`, the existing default connection will be disconnected and replaced with percona_connection under the same connection_specification_name. Because rails now re-uses the connection object created before migration, this will raise exception because it was disconnected for percona.

This commit tries to override the connection_specification_name, and hence the cached connection by rails will remain alive.
Copy link

@sauloperez sauloperez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please reflect this change somehow in the integration tests? I feel like we don't run the integration tests as we do in an actual migration and that might be a problem here.

Besides, I don't fully grasp how this relates to #with_advisory_lock and the connection var. If I understood correctly the problem is that at the time rails tries to release the lock the connection is released already, right?

@aqeelvn aqeelvn closed this May 2, 2018
@aqeelvn aqeelvn reopened this May 2, 2018
@sauloperez sauloperez mentioned this pull request Aug 31, 2018
muffinista added a commit to bandzoogle/departure that referenced this pull request Mar 21, 2019
This is basically a cherry pick of departurerb#32
@wyhaines
Copy link

This is a simple change that seems important for the continued use of departure. I'm going to merge it.

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.

Rails 5.2.0 migration fails with departure
4 participants