Skip to content
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

Support INFO command in UnifiedJedis #4078

Closed
wants to merge 2 commits into from
Closed

Conversation

sazzad16
Copy link
Contributor

@sazzad16 sazzad16 commented Feb 2, 2025

This PR target's to resolve #4094

In PR 4079 is suggested simplified approach were in case of cluster, INFO command is send to arbitrary node.

This PR suggests broadcasting the command to all node's from the cluster and return's aggregated response in complex object

@sazzad16 sazzad16 marked this pull request as ready for review February 3, 2025 06:06

private static final Object DUMMY_OBJECT = new Object();

private final Map<Object, Object> replies;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not Map<HostAndPort, Object> replies; or NodeID?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we don't a specified solution for this, e.g. in ConnectionProvider and CommandExecutor interfaces, yet. For example, in ConnectionProvider interface the respective method definition is Map<?, ?> getConnectionMap().

@@ -353,6 +358,16 @@ public String configSet(String parameter, String value) {
return checkAndBroadcastCommand(commandObjects.configSet(parameter, value));
}

public final JedisBroadcastReplies info() {
Copy link
Contributor

@ggivo ggivo Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be a bit strange API when connecting to standalone Redis using let's say UnifiedJedis.
Then you will get a JedisBroadcastReplies which makes sense for the cluster.
But in case of standalone, you will get JedisBroadcastReplies, and to get to actual value need to invoke JedisBroadcastReplies::getReplies(with host/port)

or end up with something like
infoReplies.getReplies().values().stream().findFirst().get()
just to get the value

@sazzad16 sazzad16 closed this Feb 14, 2025
@sazzad16 sazzad16 deleted the info-uj branch February 14, 2025 09:46
@sazzad16 sazzad16 restored the info-uj branch February 14, 2025 09:46
@sazzad16 sazzad16 reopened this Feb 14, 2025
@ggivo
Copy link
Contributor

ggivo commented Feb 14, 2025

@uglide @sazzad16
Spent some time looking at the suggestion for adding INFO command to UnifiedJedis, and here are my suggestions

  1. In UnifedJedis we provide info() command implementation with proper interface for standalone invocation
  public  String info()
...
  public String info(String section) 
  1. In JedisCluster, we provide an additional infoAllNodes() method that broadcasts to all nodes and returns replies from each node.
public final JedisBroadcastReplies info() {
  ...
public final JedisBroadcastReplies info(String section) {
  
  1. broadcastCommandDifferingReplies is moved toward ClusterCommandExecutor and removed from 'CommandExecutor'
    No need to broadcast in UnifiedJedis itself, and this will allow us to get rid of the DUMMY key and use typed reply map Map<HostPort, T> for the reply list.

Here is a draft with the proposal.
ggivo@c4cbd1a

@ggivo
Copy link
Contributor

ggivo commented Feb 18, 2025

After a discussion with the team was decided to proceed with approach selected in PR 4079,

@ggivo ggivo closed this Feb 18, 2025
@sazzad16 sazzad16 deleted the info-uj branch February 18, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for INFO command in UnifiedJedis
3 participants