GEODE-9585: adding support for the KEYSLOT command - #6847
Merged
upthewaterspout merged 7 commits intoSep 13, 2021
Merged
Conversation
Adding support for the keyslot command. refactoring the RedisKey code a little bit to move the slot calculation into a static method that can be used and tested separately. Changing RedisKey.crc16 to slot, because that is only thing we are using the crc16 field for.
upthewaterspout
requested review from
DonalEvans,
dschneider-pivotal,
kirklund,
nonbinaryprogrammer and
ringles
as code owners
September 8, 2021 16:35
upthewaterspout
marked this pull request as draft
September 8, 2021 17:20
DonalEvans
approved these changes
Sep 8, 2021
Fixing the argument parsing to return the correct error for different cluster subcommands, and adding additional tests for argument parsing and results from CLUSTER KEYSLOT
upthewaterspout
marked this pull request as ready for review
September 9, 2021 04:05
kirklund
reviewed
Sep 9, 2021
| /** | ||
| * Utility for parsing the hashtags in a redis key and computing the redis slot of the key. | ||
| */ | ||
| public class KeyHashUtil { |
Contributor
There was a problem hiding this comment.
I think a unit test for KeyHashUtil would be valuable and pretty easy to write.
Contributor
Author
There was a problem hiding this comment.
I added a new test. This code was previously covered by the RedisKey unit test. I moved that testing into KeyHashUtilTest and added more coverage.
Changing the implementation of slotForKey to more closely mirror the logic of the native redis keyHashSlot method. This reproduces the same behavior as native redis with malformed hashtags with unmatched parens. Moving hashing until test from RedisKeyTest to KeyHashUtilTest. Adding more test cases including a junit quick check case, that catch the problem that Darrel pointed out with mismatched parens. Applying additional review comments.
Removing an unneeded comment and assertion
Co-authored-by: Eric Zoerner <zoernere@vmware.com>
Contributor
Author
|
@ezoerner - added the randomized integration test. |
6 tasks
dschneider-pivotal
approved these changes
Sep 13, 2021
| * byte identifier of a bulk string | ||
| */ | ||
| public static final byte BULK_STRING_ID = 36; // '$' | ||
| public static final byte BULK_STRING_ID = '$'; |
Contributor
There was a problem hiding this comment.
Is a java character literal's ordinal value stable? Or can it change based on the locale? If you know the answer can you send a link?
Contributor
Author
There was a problem hiding this comment.
The only link I have is the java language spec - https://docs.oracle.com/javase/specs/jls/se16/html/jls-3.html#jls-3.10.4. The character literals are UTF-16.
upthewaterspout
deleted the
feature/support-cluster-keyslots-GEODE-9585
branch
September 13, 2021 17:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adding support for the keyslot command. refactoring the RedisKey code a little
bit to move the slot calculation into a static method that can be used and
tested separately. Changing RedisKey.crc16 to slot, because that is only thing
we are using the crc16 field for.
Thank you for submitting a contribution to Apache Geode.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
Has your PR been rebased against the latest commit within the target branch (typically
develop)?Is your initial contribution a single, squashed commit?
Does
gradlew buildrun cleanly?Have you written or updated unit tests to verify your changes?
If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
Note:
Please ensure that once the PR is submitted, check Concourse for build issues and
submit an update to your PR as soon as possible. If you need help, please send an
email to dev@geode.apache.org.