-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Introducing periodic topology mechanism for JedisCluster #3596
Introducing periodic topology mechanism for JedisCluster #3596
Conversation
b50121f
to
3100eb8
Compare
3100eb8
to
2a46e65
Compare
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #3596 +/- ##
============================================
+ Coverage 71.46% 71.49% +0.02%
- Complexity 4848 4860 +12
============================================
Files 288 288
Lines 15464 15511 +47
Branches 1095 1105 +10
============================================
+ Hits 11051 11089 +38
- Misses 3934 3938 +4
- Partials 479 484 +5
☔ View full report in Codecov by Sentry. |
@sazzad16 The PR is now available for review, and I have updated the top comments with more details, please take a look at it when you are free. |
notice: #3597 has been included in this PR. |
Co-authored-by: M Sazzadul Hoque <[email protected]>
Co-authored-by: M Sazzadul Hoque <[email protected]>
Co-authored-by: M Sazzadul Hoque <[email protected]>
f7f2c5a
to
9f9f677
Compare
socket.connect(new InetSocketAddress(host.getHostAddress(), hostAndPort.getPort()), connectionTimeout); | ||
// Passing 'host' directly will avoid another call to InetAddress.getByName() inside the InetSocketAddress constructor. | ||
// For machines with ipv4 and ipv6, but the startNode uses ipv4 to connect, the ipv6 connection may fail. | ||
socket.connect(new InetSocketAddress(host, hostAndPort.getPort()), connectionTimeout); |
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.
[Adding for future reference:]
Please check #3597 for more information about this change.
@sazzad16 I will backport it to 4. x and 3. x, WDYT? |
@yangbodong22011 I think I can manage 4.x. You can do it if you want. I'm not doing it now because there will be a patch release for 4 and I don't want to manage more branches (if I can). About 3.x, I doubt if there will ever be a new 3 minor release. |
Thank you, that would be great. p.s. I took the initiative to propose a backport, on the one hand because you are busy, and on the other hand, to truly complete it.
I believe that this PR is not only an enhancement, but also a fix, and it is worth releasing a 3. x version. If you agree, I can backport to 3.x. |
You can craft both backport PRs if you want. But I can't promise a new 3 release. |
The main changes in this PR are as follows: 1. Add `topologyRefreshEnabled` and `topologyRefreshPeriod` to control the periodic topology refresh mechanism. 2. `topologyRefreshExecutor` is a single-threaded executor responsible for running `TopologyRefreshTask`. 3. Add `checkClusterSlotSequence` to check whether the cluster slots returned by the server are consecutive and there are no duplicates. 4. [Test] In JedisClusterTestBase, `CLUSTER RESET SOFT` was changed to `HARD`, because SOFT cannot clean up the Redis Cluster configuration and may cause a crash. Please refer to redis/redis#12701 5. [Test] Adjust the cluster-node-timeout in the Makefile to 15s, consistent with the default configuration of Redis. --------- * Introducing periodic topology mechanism for JedisCluster * Apply suggestions from sazzad16 Co-authored-by: M Sazzadul Hoque <[email protected]> * Remove topologyRefreshEnabled * Apply suggestions from sazzad16 Co-authored-by: M Sazzadul Hoque <[email protected]> * remove save topologyRefreshPeriod * Move INIT_NO_ERROR_PROPERTY to JedisCluster * add timeout for clusterPeriodTopologyRefreshTest * Update src/main/java/redis/clients/jedis/DefaultJedisSocketFactory.java Co-authored-by: M Sazzadul Hoque <[email protected]> --------- Co-authored-by: M Sazzadul Hoque <[email protected]>
solves #3595
EDIT: The main changes in this PR are as follows:
topologyRefreshEnabled
andtopologyRefreshPeriod
to control the periodic topology refresh mechanism.topologyRefreshExecutor
is a single-threaded executor responsible for runningTopologyRefreshTask
.checkClusterSlotSequence
to check whether the cluster slots returned by the server are consecutive and there are no duplicates.CLUSTER RESET SOFT
was changed toHARD
, because SOFT cannot clean up the Redis Cluster configuration and may cause a crash. Please refer to [CRASH] Cluster CLUSTERMSG_EXT_TYPE_FORGOTTEN_NODE redis#12701