From 169407d734441e944fec22422330d59ecb104a11 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Wed, 19 Jun 2024 10:28:37 -0700 Subject: [PATCH] Fix routing for `FLUSHALL` and `FLUSHDB`. Signed-off-by: Yury-Fridlyand --- .../main/java/glide/api/RedisClusterClient.java | 10 ++++------ .../ServerManagementClusterCommands.java | 17 ++++++++--------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/java/client/src/main/java/glide/api/RedisClusterClient.java b/java/client/src/main/java/glide/api/RedisClusterClient.java index ec88fc7c18..b20f7b4202 100644 --- a/java/client/src/main/java/glide/api/RedisClusterClient.java +++ b/java/client/src/main/java/glide/api/RedisClusterClient.java @@ -336,14 +336,13 @@ public CompletableFuture flushall(@NonNull FlushMode mode) { } @Override - public CompletableFuture flushall(@NonNull SingleNodeRoute route) { + public CompletableFuture flushall(@NonNull Route route) { return commandManager.submitNewCommand( FlushAll, new String[0], route, this::handleStringResponse); } @Override - public CompletableFuture flushall( - @NonNull FlushMode mode, @NonNull SingleNodeRoute route) { + public CompletableFuture flushall(@NonNull FlushMode mode, @NonNull Route route) { return commandManager.submitNewCommand( FlushAll, new String[] {mode.toString()}, route, this::handleStringResponse); } @@ -360,14 +359,13 @@ public CompletableFuture flushdb(@NonNull FlushMode mode) { } @Override - public CompletableFuture flushdb(@NonNull SingleNodeRoute route) { + public CompletableFuture flushdb(@NonNull Route route) { return commandManager.submitNewCommand( FlushDB, new String[0], route, this::handleStringResponse); } @Override - public CompletableFuture flushdb( - @NonNull FlushMode mode, @NonNull SingleNodeRoute route) { + public CompletableFuture flushdb(@NonNull FlushMode mode, @NonNull Route route) { return commandManager.submitNewCommand( FlushDB, new String[] {mode.toString()}, route, this::handleStringResponse); } diff --git a/java/client/src/main/java/glide/api/commands/ServerManagementClusterCommands.java b/java/client/src/main/java/glide/api/commands/ServerManagementClusterCommands.java index d8a7a40b88..bb53cbc96d 100644 --- a/java/client/src/main/java/glide/api/commands/ServerManagementClusterCommands.java +++ b/java/client/src/main/java/glide/api/commands/ServerManagementClusterCommands.java @@ -6,7 +6,6 @@ import glide.api.models.commands.InfoOptions; import glide.api.models.commands.InfoOptions.Section; import glide.api.models.configuration.RequestRoutingConfiguration.Route; -import glide.api.models.configuration.RequestRoutingConfiguration.SingleNodeRoute; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -353,7 +352,7 @@ public interface ServerManagementClusterCommands { * * @see valkey.io for details. * @param route Specifies the routing configuration for the command. The client will route the - * command to the node defined by route. + * command to the nodes defined by route. * @return OK. * @example *
{@code
@@ -362,7 +361,7 @@ public interface ServerManagementClusterCommands {
      * assert response.equals("OK");
      * }
*/ - CompletableFuture flushall(SingleNodeRoute route); + CompletableFuture flushall(Route route); /** * Deletes all the keys of all the existing databases. This command never fails. @@ -371,7 +370,7 @@ public interface ServerManagementClusterCommands { * @param mode The flushing mode, could be either {@link FlushMode#SYNC} or {@link * FlushMode#ASYNC}. * @param route Specifies the routing configuration for the command. The client will route the - * command to the node defined by route. + * command to the nodes defined by route. * @return OK. * @example *
{@code
@@ -380,7 +379,7 @@ public interface ServerManagementClusterCommands {
      * assert response.equals("OK");
      * }
*/ - CompletableFuture flushall(FlushMode mode, SingleNodeRoute route); + CompletableFuture flushall(FlushMode mode, Route route); /** * Deletes all the keys of the currently selected database. This command never fails.
@@ -417,7 +416,7 @@ public interface ServerManagementClusterCommands { * * @see valkey.io for details. * @param route Specifies the routing configuration for the command. The client will route the - * command to the node defined by route. + * command to the nodes defined by route. * @return OK. * @example *
{@code
@@ -426,7 +425,7 @@ public interface ServerManagementClusterCommands {
      * assert response.equals("OK");
      * }
*/ - CompletableFuture flushdb(SingleNodeRoute route); + CompletableFuture flushdb(Route route); /** * Deletes all the keys of the currently selected database. This command never fails. @@ -435,7 +434,7 @@ public interface ServerManagementClusterCommands { * @param mode The flushing mode, could be either {@link FlushMode#SYNC} or {@link * FlushMode#ASYNC}. * @param route Specifies the routing configuration for the command. The client will route the - * command to the node defined by route. + * command to the nodes defined by route. * @return OK. * @example *
{@code
@@ -444,7 +443,7 @@ public interface ServerManagementClusterCommands {
      * assert response.equals("OK");
      * }
*/ - CompletableFuture flushdb(FlushMode mode, SingleNodeRoute route); + CompletableFuture flushdb(FlushMode mode, Route route); /** * Displays a piece of generative computer art and the Redis version.