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

feat: support Elasticache cluster mode by setting IsClusterMode in config #3255

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

Conversation

reeshijoshi
Copy link

  • This is required because Elasticache supports setting up cluster mode with configuration endpoint. So the check len(Addrs) > 1 is not enough for determining cluster mode.
  • If IsClusterMode is true, the client will be created as a cluster client.

@ndyakov
Copy link
Collaborator

ndyakov commented Jan 29, 2025

@reeshijoshi thank you for the contribution. Would you be able to add tests for this new option?

@reeshijoshi
Copy link
Author

@reeshijoshi thank you for the contribution. Would you be able to add tests for this new option?

This needs an Elasticache configuration endpoint to be provided in the Addrs field. I can add a unit test with one address only in this but that's not representative of how this would behave in the actual scenario

@reeshijoshi
Copy link
Author

@reeshijoshi thank you for the contribution. Would you be able to add tests for this new option?

Added a test that asserts client type

@ndyakov
Copy link
Collaborator

ndyakov commented Jan 30, 2025

@vladvildanov I think this one is good to be merged.

@ndyakov ndyakov self-requested a review January 30, 2025 15:29
Copy link
Collaborator

@ndyakov ndyakov left a comment

Choose a reason for hiding this comment

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

@reeshijoshi Overall looks good to me, would you mind changing the comment as suggested or anything starting with the IsClusterMode as suggested in https://tip.golang.org/doc/comment

ndyakov
ndyakov previously approved these changes Jan 31, 2025
Copy link
Collaborator

@ndyakov ndyakov 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, thanks @reeshijoshi

@@ -38,4 +38,13 @@ var _ = Describe("UniversalClient", func() {
})
Expect(client.Ping(ctx).Err()).NotTo(HaveOccurred())
})

It("should connect to clusters if IsClusterMode is set even if only a single address is provided", Label("NonRedisEnterprise"), func() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ndyakov This test is an integration test, right? So we basically test if handshake had happened and it's possible to connect to cluster via single endpoint?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@reeshijoshi , what Vlad said is valid. Let's check if the cluster slots response includes all slots.

Copy link
Author

Choose a reason for hiding this comment

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

@ndyakov I think this should only be a test for whether setting IsClusterMode: true actually returns an instance of ClusterClient. I don't think verifying whether all the connectivity is setup correctly should be in the scope of this PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

What this will test is if the cluster client is working properly with a single endpoint. It can be in a separate place, but let’s add such test before including the possibility of initiating cluster client with single endpoint.

Copy link
Author

Choose a reason for hiding this comment

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

@ndyakov apologies I've been away on a vacation. I've pushed a a new test checking length of cluster slots. Let me know if this solves it!

@ndyakov
Copy link
Collaborator

ndyakov commented Feb 20, 2025

@reeshijoshi would you please add additional test so we can merge this?

@reeshijoshi
Copy link
Author

@reeshijoshi would you please add additional test so we can merge this?

done

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.

4 participants