-
Notifications
You must be signed in to change notification settings - Fork 3.9k
refresh connection for pipeline when getting JedisMovedDataException #3699
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
base: master
Are you sure you want to change the base?
Conversation
should get connection first and then create new pipeline queue, otherwise it would cause NPE when timeout for getting connection and call sync() method
pipelinedResponses should be clear in MultiNodePipelineBase.java and avoid this pipeline object reporting ENP when executing close() and reuse
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #3699 +/- ##
=========================================
Coverage 75.64% 75.65%
- Complexity 4914 4915 +1
=========================================
Files 297 297
Lines 14956 14957 +1
Branches 1124 1124
=========================================
+ Hits 11314 11316 +2
Misses 3149 3149
+ Partials 493 492 -1 ☔ View full report in Codecov by Sentry. |
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.
@stillerrr What about inner Queue
s in pipelinedResponses?
I think it would be okay, the queue would be empty after executing sync(), but pipelinedResponses also has the empty queue once the pipeline object is reused, there is no connection in connnections map, but has queue in pipelinedResponses map |
@sazzad16 add method to refresh connection for pipeline when getting JedisMovedDataException |
@sazzad16 PTAL |
Hey, could you provide an example code demonstrating the expected usage? I agree there is currently no switch (and NPE is not good outcome), but for me, using |
This pull request is marked stale. It will be closed in 30 days if it is not updated. |
I want to see #3915 fixed as I would be able to remove a log of ugly workarounds from several different projects where I use Jedis, so I'm jumping in as I don't want this stale-closed... I'm not OP but in their absense I'll offer my interpretation of their intent:
I interpreted the "can" in "MultiNodePipelineBase can be reused when calling close()" as "could" rather than "should". I.e. since there's no guards elsewhere in the class to prevent this, the new functionality in this PR doesn't assume that the class won't be used after close. |
@snago @stillerrr If I now understand correctly, the issue isn’t about reusing a Here’s a concrete example to illustrate the expexcted usage pattern:
Let me know if I’ve now captured the concern accurately |
Yes, and even worse. If you do all commands in pipelines, all the JedisMovedDataExceptions will get "swallowed" by the pipelines and the JedisCluster will never recover from a cluster change. |
I think in this case, the change makes sense, but we are missing tests to make sure the internal queues are handled properly after replacing the initial connections. |
If you want to I could try to write some tests. |
132qianming
|
The team is a bit stretched currently, and help is appreciated. |
pipelinedResponses should be clear in MultiNodePipelineBase.java and avoid this pipeline object reporting ENP when executing close() and reuse like #3697
MultiNodePipelineBase can be reused when calling close(), there is no switch to avoid this way to use MultiNodePipelineBase