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

Remove owner_name #38672

Merged
merged 1 commit into from
Mar 7, 2020
Merged

Remove owner_name #38672

merged 1 commit into from
Mar 7, 2020

Conversation

eileencodes
Copy link
Member

We don't actually need this since the only reason it exists is to pass
the owning class name down to the handler. This removes a level of
indirection and an unnecessary accessor on db_config. db_config
shouldn't have to know what class owns it, so we can just remove this
and pass it to the handler.

The Symbol case is needed to preserve current behavior. This doesn't
need a changelog because it's changing un-released behavior.

Co-authored-by: John Crepezzi john.crepezzi@gmail.com

handler = lookup_connection_handler(role)

handler.establish_connection(db_config)
handler.establish_connection(db_config, :default, owner_name)
Copy link
Member

Choose a reason for hiding this comment

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

Should :default be ActiveRecord::Base.default_pool_key?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, I fixed this and the other one.

We don't actually need this since the only reason it exists is to pass
the owning class name down to the `handler`. This removes a level of
indirection and an unnecessary accessor on db_config. db_config
shouldn't have to know what class owns it, so we can just remove this
and pass it to the handler.

The Symbol case is needed to preserve current behavior. This doesn't
need a changelog because it's changing un-released behavior.

Co-authored-by: John Crepezzi <john.crepezzi@gmail.com>
@eileencodes eileencodes merged commit e00f9c8 into rails:master Mar 7, 2020
@eileencodes eileencodes deleted the remove-owner_name branch March 7, 2020 15:06
eileencodes added a commit to eileencodes/rails that referenced this pull request Jul 5, 2022
The majority of where this functionality was removed in rails#38672.
`owner_name` was never used publicaly in the db_config and was at a time
used for identifying connection owners. Now the connection owner is
always stored in the PoolConfig (same place as the db_config) so the
db_config doesn't need this information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants