#319 Fixed Redis Cluster Crossslot Issue #320
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Issue Link: #319
The issue is occurring while renaming the temporary key with actual key because the hash slot for temporary key (with _tmp suffix) and actual key (without _tmp suffix) should be same. If they are not same, redis will throw an error:
To solve this,we need to force the temporary key to be in the same hash slot. We can do this by adding hashtag to the actual part of the temporary key. When the key contains a "{...}" pattern, only the substring between the braces, "{" and "}," is hashed to obtain the hash slot.
Pull request type
Please check the type of change your PR introduces:
Checklist
Does this introduce a breaking change?
Further comments
This change I have tested in my environment with 3 master node - 3 replica node redis cluster. It is working fine.