Skip to content

Adds redis sentinel support#1554

Merged
arschles merged 15 commits intogomods:masterfrom
twexler:redis-sentinel
Mar 17, 2020
Merged

Adds redis sentinel support#1554
arschles merged 15 commits intogomods:masterfrom
twexler:redis-sentinel

Conversation

@twexler
Copy link
Collaborator

@twexler twexler commented Feb 24, 2020

What is the problem I am trying to address?

Redis sentinel support

How is the fix applied?

Adds a WithRedisSentinelLock to stash package, adds various configuration bits needed.

Mention the issue number it fixes or add the details of the changes if it doesn't have a specific issue.

Fixes #1553

@twexler twexler added do not merge discussion prs, opinion prs, etc. enhancement New feature or request hosting Work to do to improve/change how we host the services labels Feb 24, 2020
Copy link
Member

@arschles arschles left a comment

Choose a reason for hiding this comment

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

@twexler this looks really good to me! 🎉 🚀

For now, I'll leave it as a comment and keep an eye out for when it's ready for review and do a new review then.

@twexler
Copy link
Collaborator Author

twexler commented Feb 25, 2020

Thanks @arschles!

Right now, I'm actually in progress of upgrading the redis module to v7 to support authenticated sentinels, this PR may expand in scope a bit. I'll keep it updated!

@twexler twexler marked this pull request as ready for review February 25, 2020 13:50
@twexler twexler requested a review from a team as a code owner February 25, 2020 13:50

// WithRedisSentinelLock returns a distributed singleflight
// with a redis cluster that utilizes sentinel for quorum and failover
func WithRedisSentinelLock(endpoints []string, master, password string, checker storage.Checker) (Wrapper, error) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This could alternatively be compacted into WithRedisLock, but I didn't want to add too much complexity. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

I like that you've separated sentinel from redis itself. sentinel is treated differently enough in the redis docs that I think we should treat it differently here from a docs and code perspective.

Copy link
Contributor

@marwan-at-work marwan-at-work left a comment

Choose a reason for hiding this comment

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

Quick review :) Thanks for the library upgrades 💯

Copy link
Member

@arschles arschles left a comment

Choose a reason for hiding this comment

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

@twexler I really like where this is going. Just made some comments, don't mind me 😄


// WithRedisSentinelLock returns a distributed singleflight
// with a redis cluster that utilizes sentinel for quorum and failover
func WithRedisSentinelLock(endpoints []string, master, password string, checker storage.Checker) (Wrapper, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I like that you've separated sentinel from redis itself. sentinel is treated differently enough in the redis docs that I think we should treat it differently here from a docs and code perspective.

@twexler twexler removed the do not merge discussion prs, opinion prs, etc. label Feb 26, 2020
@arschles
Copy link
Member

arschles commented Mar 7, 2020

@twexler @marwan-at-work I think we should decide if we want to make sentinel support configurable as part of the existing redis config, or a new config section in the TOML. I thought it over and I vote for a separate config (even though it's the same client in the code).

It's more work for us on almost all fronts, but I believe it'll be harder to write docs, but easier to document. And I think a separate documentation section for sentinel vs. non-sentinel will be easier to understand for users.

Can you 👍 on this if you share my vote (I've already cast my vote here), and 👎 on this if you want to merge the configs?

@twexler
Copy link
Collaborator Author

twexler commented Mar 7, 2020

I'm okay with keeping it separate, but in that case...let me take the docs question on in this PR as well, so we can have full agreement on how to document this

@arschles
Copy link
Member

arschles commented Mar 7, 2020

sounds good @twexler

Copy link
Member

@chriscoffee chriscoffee left a comment

Choose a reason for hiding this comment

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

Looks good to me just some typos!

Copy link
Member

@arschles arschles left a comment

Choose a reason for hiding this comment

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

:shipit: 🎉 🚀

Thanks again for this @twexler !

Since #1554 (comment) has 2 votes, and there were 3 people in that particular discussion about combining the sentinel config to the single-node config, vs. separate configs (what this PR has currently), we are going to go with the config situation in this PR as-is.

@arschles arschles merged commit 939e695 into gomods:master Mar 17, 2020
@twexler twexler deleted the redis-sentinel branch March 17, 2020 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request hosting Work to do to improve/change how we host the services

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SingleFlight should support Redis Sentinel

4 participants