-
Notifications
You must be signed in to change notification settings - Fork 59
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
Java: Add INFO() commands to java client #920
Java: Add INFO() commands to java client #920
Conversation
82d8d78
to
8380ba4
Compare
ac70a01
to
9c78c96
Compare
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
9c78c96
to
ce22c12
Compare
* | ||
* @see <a href="https://redis.io/commands/info/">redis.io</a> for details. {@link | ||
* InfoOptions.Section#DEFAULT} option is assumed. | ||
* @return Response from Redis cluster with a <code>String</code> containing the information for |
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.
Without routing the info request is routed to multi-nodes (all primaries), so the return value is a map of strings. should be documented
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.
Can you add an example, so it would be clearer that getMulti needs to be called in these functions by default
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.
How is this:
/**
* Get information and statistics about the Redis server. DEFAULT option is assumed. The command
* will be routed to all primaries.
*
* @see <a href="https://redis.io/commands/info/">redis.io</a> for details. {@link
* InfoOptions.Section#DEFAULT} option is assumed.
* @return Response from Redis cluster with a <code>Map{@literal <String, String>}</code> with each address
* as the key and its corresponding value is the information for the node.
* @example
* <p><code>
* {@literal Map<String, String>} routedInfoResult = clusterClient.info().get().getMultiValue();
* </code>
*/
* | ||
* @see <a href="https://redis.io/commands/info/">redis.io</a> for details. | ||
* @param options - A list of {@link InfoOptions.Section} values specifying which sections of | ||
* information to retrieve. When no parameter is provided, the {@link |
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.
Should be mentioned that it's being sent to all primaries and that the return type is a map
3) "92d73b6eb847604b63c7f7cbbf39b148acdd1318" | ||
4) (empty array) | ||
*/ | ||
// Extracting first slot key |
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.
[0])[2])[2] is the node ID == "92d73b6eb847604b63c7f7cbbf39b148acdd1318", why do you need it? why do you need to run cluster slots at all?
If you want to have a routing of a primary you can simply do new SlotKeyRoute("foo", PRIMARY);
, we're covering all slots when we create the cluster so it would simply send the request to the primary that holds the slot of crc16("foo")
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.
This is just testing that we can do this. It's maybe not the most efficient command.
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.
LGTM, please fix the comments
@Override | ||
public CompletableFuture<ClusterValue<String>> info() { | ||
return commandManager.submitNewCommand( | ||
Info, new String[0], response -> ClusterValue.of(handleObjectOrNullResponse(response))); |
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.
Is null accepted here?
Info, new String[0], response -> ClusterValue.of(handleObjectOrNullResponse(response))); | |
Info, new String[0], response -> ClusterValue.of(handleObjectResponse(response))); |
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.
I suppose that makes sense.
Signed-off-by: Andrew Carbonetto <[email protected]>
Issue #, if available:
This PR is dependent to: #917
Description of changes:
This PR adds get/set/ping/info calls to the standalone, and cluster-mode:
note: info() command returns different sections in Redis version 6 vs version 7. IT tests have added the Redis version system variable to help test results expect version-specific results.
Examples:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.