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

Specifying the name of the replica with the distribute_reads method #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fabienpiette
Copy link

Issue: #37

@ankane
Copy link
Owner

ankane commented May 27, 2020

Hey @fabienpiette, thanks for the PR, including tests 💯

As I was going reviewing/compiling feedback for this, I think I found a slightly different way that doesn't require a custom strategy (which would allow it to work with any strategy). I don't typically do this, but I put together a branch to try it out. I'd be curious to hear your thoughts. https://github.com/ankane/distribute_reads/compare/named_connections

For this PR, I believe the approach isn't thread-safe, as @slave_pool.current_name will be shared across threads.

All that being said, both approaches add a bit more complexity than I was hoping for, so still on the fence.

@fabienpiette
Copy link
Author

Hi!
Indeed the current_name wasn't thread safe, I find your approach much more elegant (especially since we don't have to define a new Makara strategy).
I've tested it locally on my project and it seems to work well.
It does add a bit of complexity but the code is clean and the code overload is only on the DistributeReads::Pool/Makara::Pool class and is quite minimal in my opinion.
Anyway my original problem is solved, well done 👍

@ankane
Copy link
Owner

ankane commented May 28, 2020

Great, glad it's working, and fwiw, your PR helped out a lot - was much easier to make some tweaks than start from scratch.

Going to leave this feature in a branch for now. Let me know if you run into any issues with it. Will feel more comfortable if it's running successfully in production for a while, as well as if others are interested in it.

@fabienpiette
Copy link
Author

No problem, thanks to you 👍

@GaudamThiyagarajan
Copy link

Great, glad it's working, and fwiw, your PR helped out a lot - was much easier to make some tweaks than start from scratch.

Going to leave this feature in a branch for now. Let me know if you run into any issues with it. Will feel more comfortable if it's running successfully in production for a while, as well as if others are interested in it.

Are we merging this anytime sooner?

@fabienpiette
Copy link
Author

Great, glad it's working, and fwiw, your PR helped out a lot - was much easier to make some tweaks than start from scratch.
Going to leave this feature in a branch for now. Let me know if you run into any issues with it. Will feel more comfortable if it's running successfully in production for a while, as well as if others are interested in it.

Are we merging this anytime sooner?

Hey ! I've been able to test these modifications in production, no problems to report for the moment, I think it can be merged soon.

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.

3 participants