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

Deprecate 'master' in favor of 'primary' #290

Merged
merged 1 commit into from
Jan 26, 2021
Merged

Deprecate 'master' in favor of 'primary' #290

merged 1 commit into from
Jan 26, 2021

Conversation

mlarraz
Copy link
Member

@mlarraz mlarraz commented Jan 19, 2021

Also deprecates the use of the slave role (although this doesn't actually matter since we just assume anything but primary is a replica).

This was referenced Jan 19, 2021
@mlarraz mlarraz force-pushed the primary branch 3 times, most recently from 11212cd to d3c5775 Compare January 26, 2021 06:07
@mlarraz mlarraz marked this pull request as ready for review January 26, 2021 06:21
Copy link

@scashin133 scashin133 left a comment

Choose a reason for hiding this comment

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

Had a couple of questions about some of the changes that appear to either be changing the behavior or don't visibly make sense. If you have good reasons I'm happy to approve.

@makara_config[:connections].map do |connection|
base_config.merge(makara_config.except(:connections))
.merge(connection.symbolize_keys)
@all_configs ||= @makara_config[:connections].map do |connection|

Choose a reason for hiding this comment

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

This seems like a behavior change. Now we won't be re-calculating all_configs each time it is called. That may ultimately be desired behavior but wanted to call out that potentially this could break things

Copy link
Member Author

Choose a reason for hiding this comment

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

AFAIK these are immutable structures anyway (since they're just loaded from config files)

Comment on lines -251 to +263
# do these args require a master connection
def needs_master?(method_name, args)
true
# Do these args require a primary connection
def needs_primary?(method_name, args)
if respond_to?(:needs_master?)
warn "#{self.class}#needs_master? is deprecated. Switch to #needs_primary?"
needs_master?(method_name, args)
else
true
end

Choose a reason for hiding this comment

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

I don't fully understand this change. How could it respond_to needs_master? since your removed that method? It also seems like it would be throwing a deprecation warning potentially when using the correct method. I'm sure there is some method magic happening that I just don't see but wanted to call it out.

Copy link
Member Author

Choose a reason for hiding this comment

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

My understanding is this method is meant to be overwritten in subclasses by users. So if someone has defined their own needs_master?, we should still call it but emit this warning that they should rename the method.

@mlarraz mlarraz merged commit b8e7f3a into master Jan 26, 2021
@mlarraz mlarraz deleted the primary branch January 26, 2021 18:14
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