-
Notifications
You must be signed in to change notification settings - Fork 955
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
[#2341] Initialize slots with empty BitSet in RedisClusterNode's constructors #2852
[#2341] Initialize slots with empty BitSet in RedisClusterNode's constructors #2852
Conversation
I kindly request your review of this pull request. Your feedback would be greatly appreciated. 🙇🏻 |
I tested everything locally and it passed, but it failed on GitHub Actions. I'll make the necessary fixes and commit again soon. |
Please ignore the failure of the SslIntegrationTests.pubSubSsl:396 - it is unstable and if you pull the latest sources you will see it is disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
Please check my comments and let me know if you need any clarifications or have some concerns.
src/main/java/io/lettuce/core/cluster/models/partitions/RedisClusterNode.java
Outdated
Show resolved
Hide resolved
src/main/java/io/lettuce/core/cluster/models/partitions/RedisClusterNode.java
Outdated
Show resolved
Hide resolved
src/test/java/io/lettuce/core/cluster/models/partitions/RedisClusterNodeUnitTests.java
Show resolved
Hide resolved
25d74c3
to
4fe8d21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey thanks for addressing the last comments.
There are still two things that I am worried about:
- We are still missing the same logic on line 90 (the first of the three constructors)
- The test is not really verifying the issue from RedisClusterNode.hasSameSlotsAs() is unreliable #2341
src/test/java/io/lettuce/core/cluster/models/partitions/RedisClusterNodeUnitTests.java
Show resolved
Hide resolved
Generally, we attempt to be as light-weight as possible. Going forward, the parser for |
Not a huge fan of using Perhaps a compromise solution would be a It would still be more than what null would take, but it would be insignificantly more. In the same time it would have the benefit of avoiding NPEs and not having to deal with null checks. What's your take on that approach? |
Allocation of |
Hey everyone, Creating a new Slots object to handle null slots sounds like a good idea. That said, if most contributors, including @tishun, prefer creating the Slots object, I’m ready to make the changes accordingly. Thanks for all the reviews and feedback! |
The memory allocated (retained size) for a singleton BitSet with size 0 is 40B total (24B of which is shallow size). For a singleton BitSet the CPU overhead would be only once per creation. IMO these are negligible and indistinguishable from using null for any modern hardware and JVM. I was going to propose to create a dedicated object myself, but would that affect the public API? My recommendation would be to go with the null object, but I will approve any solution that resolves the problem without introducing new problems itself. |
I acknowledge the necessity of creating a separate For this PR, I suggest we focus on the current approach of using
As English is not my first language, I would appreciate it if you could confirm whether I have correctly understood your opinions. Thank you. |
I confirmed that my pull request failed during the integration tests. It seems like the failure is related to |
There was a change in the redis/redis codebase that broke the tests, it has been since fixed. |
Actually - my bad - you will have to rebase your change to include the fix. Sorry about that. See #2871 |
Thanks @tishun, I completed the rebase based on the PR you mentioned. |
Hm something seems off to me, your change should not span 85 files |
…de's constructors
…terNode constructors
…nstructor and compare the two clusters with hasSameSlotsAs()
d873986
to
18572c0
Compare
There, I fixed it :) |
Issue: #2341
This PR supersedes the previously closed PR #2798
Make sure that: