From fdb65c10c54a3bcf9f104d53d86d3bf55ad53290 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Mon, 27 May 2024 19:14:22 -0700 Subject: [PATCH 1/5] Update implementation for `FUNCTION LOAD`. Signed-off-by: Yury-Fridlyand --- .../src/main/java/glide/api/RedisClient.java | 17 ++----- .../java/glide/api/RedisClusterClient.java | 34 ++++--------- .../ScriptingAndFunctionsClusterCommands.java | 51 +++---------------- .../ScriptingAndFunctionsCommands.java | 24 ++------- .../glide/api/models/BaseTransaction.java | 25 +++------ .../test/java/glide/api/RedisClientTest.java | 6 +-- .../glide/api/RedisClusterClientTest.java | 14 ++--- .../glide/api/models/TransactionTests.java | 2 +- .../java/glide/TransactionTestUtilities.java | 6 +-- .../test/java/glide/cluster/CommandTests.java | 16 +++--- .../java/glide/standalone/CommandTests.java | 8 +-- 11 files changed, 61 insertions(+), 142 deletions(-) diff --git a/java/client/src/main/java/glide/api/RedisClient.java b/java/client/src/main/java/glide/api/RedisClient.java index 79c3ba9a45..c70586f9b9 100644 --- a/java/client/src/main/java/glide/api/RedisClient.java +++ b/java/client/src/main/java/glide/api/RedisClient.java @@ -1,6 +1,7 @@ /** Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.api; +import static glide.api.models.commands.function.FunctionLoadOptions.REPLACE; import static glide.utils.ArrayTransformUtils.castArray; import static glide.utils.ArrayTransformUtils.concatenateArrays; import static glide.utils.ArrayTransformUtils.convertMapToKeyValueStringArray; @@ -28,7 +29,6 @@ import glide.api.models.Transaction; import glide.api.models.commands.FlushMode; import glide.api.models.commands.InfoOptions; -import glide.api.models.commands.function.FunctionLoadOptions; import glide.api.models.configuration.RedisClientConfiguration; import glide.managers.CommandManager; import glide.managers.ConnectionManager; @@ -191,16 +191,9 @@ public CompletableFuture lolwut(int version, int @NonNull [] parameters) } @Override - public CompletableFuture functionLoad(@NonNull String libraryCode) { - return commandManager.submitNewCommand( - FunctionLoad, new String[] {libraryCode}, this::handleStringResponse); - } - - @Override - public CompletableFuture functionLoadReplace(@NonNull String libraryCode) { - return commandManager.submitNewCommand( - FunctionLoad, - new String[] {FunctionLoadOptions.REPLACE.toString(), libraryCode}, - this::handleStringResponse); + public CompletableFuture functionLoad(@NonNull String libraryCode, boolean replace) { + String[] arguments = + replace ? new String[] {REPLACE.toString(), libraryCode} : new String[] {libraryCode}; + return commandManager.submitNewCommand(FunctionLoad, arguments, this::handleStringResponse); } } diff --git a/java/client/src/main/java/glide/api/RedisClusterClient.java b/java/client/src/main/java/glide/api/RedisClusterClient.java index 6a097cbfbd..f3eef93797 100644 --- a/java/client/src/main/java/glide/api/RedisClusterClient.java +++ b/java/client/src/main/java/glide/api/RedisClusterClient.java @@ -2,6 +2,7 @@ package glide.api; import static glide.api.commands.ServerManagementCommands.VERSION_REDIS_API; +import static glide.api.models.commands.function.FunctionLoadOptions.REPLACE; import static glide.utils.ArrayTransformUtils.castArray; import static glide.utils.ArrayTransformUtils.castMapOfArrays; import static glide.utils.ArrayTransformUtils.concatenateArrays; @@ -30,7 +31,6 @@ import glide.api.models.ClusterValue; import glide.api.models.commands.FlushMode; import glide.api.models.commands.InfoOptions; -import glide.api.models.commands.function.FunctionLoadOptions; import glide.api.models.configuration.RedisClusterClientConfiguration; import glide.api.models.configuration.RequestRoutingConfiguration.Route; import glide.api.models.configuration.RequestRoutingConfiguration.SingleNodeRoute; @@ -418,32 +418,18 @@ public CompletableFuture> lolwut( } @Override - public CompletableFuture functionLoad(@NonNull String libraryCode) { - return commandManager.submitNewCommand( - FunctionLoad, new String[] {libraryCode}, this::handleStringResponse); - } - - @Override - public CompletableFuture functionLoadReplace(@NonNull String libraryCode) { - return commandManager.submitNewCommand( - FunctionLoad, - new String[] {FunctionLoadOptions.REPLACE.toString(), libraryCode}, - this::handleStringResponse); - } - - @Override - public CompletableFuture functionLoad(@NonNull String libraryCode, @NonNull Route route) { - return commandManager.submitNewCommand( - FunctionLoad, new String[] {libraryCode}, route, this::handleStringResponse); + public CompletableFuture functionLoad(@NonNull String libraryCode, boolean replace) { + String[] arguments = + replace ? new String[] {REPLACE.toString(), libraryCode} : new String[] {libraryCode}; + return commandManager.submitNewCommand(FunctionLoad, arguments, this::handleStringResponse); } @Override - public CompletableFuture functionLoadReplace( - @NonNull String libraryCode, @NonNull Route route) { + public CompletableFuture functionLoad( + @NonNull String libraryCode, boolean replace, @NonNull Route route) { + String[] arguments = + replace ? new String[] {REPLACE.toString(), libraryCode} : new String[] {libraryCode}; return commandManager.submitNewCommand( - FunctionLoad, - new String[] {FunctionLoadOptions.REPLACE.toString(), libraryCode}, - route, - this::handleStringResponse); + FunctionLoad, arguments, route, this::handleStringResponse); } } diff --git a/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java b/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java index 1b72619e97..db01795e84 100644 --- a/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java +++ b/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java @@ -13,47 +13,30 @@ public interface ScriptingAndFunctionsClusterCommands { /** - * Loads a library to Redis unless a library with the same name exists. Use {@link - * #functionLoadReplace(String)} to replace existing libraries.
+ * Loads a library to Redis unless a library with the same name exists.
* The command will be routed to all primary nodes. * * @since Redis 7.0 and above. * @see redis.io for details. * @param libraryCode The source code that implements the library. + * @param replace Whether new library overwrites a library with the same name if it exists. * @return The library name that was loaded. * @example *
{@code
      * String code = "#!lua name=mylib \n redis.register_function('myfunc', function(keys, args) return args[1] end)";
-     * String response = client.functionLoad(code).get();
+     * String response = client.functionLoad(code, true).get();
      * assert response.equals("mylib");
      * }
*/ - CompletableFuture functionLoad(String libraryCode); + CompletableFuture functionLoad(String libraryCode, boolean replace); /** - * Loads a library to Redis and overwrites a library with the same name if it exists.
- * The command will be routed to all primary nodes. - * - * @since Redis 7.0 and above. - * @see redis.io for details. - * @param libraryCode The source code that implements the library. - * @return The library name that was loaded. - * @example - *
{@code
-     * String code = "#!lua name=mylib \n redis.register_function('myfunc', function(keys, args) return args[1] end)";
-     * String response = client.functionLoadReplace(code).get();
-     * assert response.equals("mylib");
-     * }
- */ - CompletableFuture functionLoadReplace(String libraryCode); - - /** - * Loads a library to Redis unless a library with the same name exists. Use {@link - * #functionLoadReplace(String, Route)} to replace existing libraries.
+ * Loads a library to Redis unless a library with the same name exists. * * @since Redis 7.0 and above. * @see redis.io for details. * @param libraryCode The source code that implements the library. + * @param replace Whether new library overwrites a library with the same name if it exists. * @param route Specifies the routing configuration for the command. The client will route the * command to the nodes defined by route. * @return The library name that was loaded. @@ -61,27 +44,9 @@ public interface ScriptingAndFunctionsClusterCommands { *
{@code
      * String code = "#!lua name=mylib \n redis.register_function('myfunc', function(keys, args) return args[1] end)";
      * Route route = new SlotKeyRoute("key", PRIMARY);
-     * String response = client.functionLoad(code, route).get();
-     * assert response.equals("mylib");
-     * }
- */ - CompletableFuture functionLoad(String libraryCode, Route route); - - /** - * Loads a library to Redis and overwrites a library with the same name if it exists. - * - * @since Redis 7.0 and above. - * @see redis.io for details. - * @param libraryCode The source code that implements the library. - * @param route Specifies the routing configuration for the command. The client will route the - * command to the nodes defined by route. - * @return The library name that was loaded. - * @example - *
{@code
-     * String code = "#!lua name=mylib \n redis.register_function('myfunc', function(keys, args) return args[1] end)";
-     * String response = client.functionLoadReplace(code, ALL_NODES).get();
+     * String response = client.functionLoad(code, true, route).get();
      * assert response.equals("mylib");
      * }
*/ - CompletableFuture functionLoadReplace(String libraryCode, Route route); + CompletableFuture functionLoad(String libraryCode, boolean replace, Route route); } diff --git a/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsCommands.java b/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsCommands.java index 190335c4e5..813f21ddb0 100644 --- a/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsCommands.java +++ b/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsCommands.java @@ -13,35 +13,19 @@ public interface ScriptingAndFunctionsCommands { /** - * Loads a library to Redis unless a library with the same name exists. Use {@link - * #functionLoadReplace} to replace existing libraries. + * Loads a library to Redis unless a library with the same name exists. * * @since Redis 7.0 and above. * @see redis.io for details. * @param libraryCode The source code that implements the library. + * @param replace Whether new library overwrites a library with the same name if it exists. * @return The library name that was loaded. * @example *
{@code
      * String code = "#!lua name=mylib \n redis.register_function('myfunc', function(keys, args) return args[1] end)";
-     * String response = client.functionLoad(code).get();
+     * String response = client.functionLoad(code, true).get();
      * assert response.equals("mylib");
      * }
*/ - CompletableFuture functionLoad(String libraryCode); - - /** - * Loads a library to Redis and overwrites a library with the same name if it exists. - * - * @since Redis 7.0 and above. - * @see redis.io for details. - * @param libraryCode The source code that implements the library. - * @return The library name that was loaded. - * @example - *
{@code
-     * String code = "#!lua name=mylib \n redis.register_function('myfunc', function(keys, args) return args[1] end)";
-     * String response = client.functionLoadReplace(code).get();
-     * assert response.equals("mylib");
-     * }
- */ - CompletableFuture functionLoadReplace(String libraryCode); + CompletableFuture functionLoad(String libraryCode, boolean replace); } diff --git a/java/client/src/main/java/glide/api/models/BaseTransaction.java b/java/client/src/main/java/glide/api/models/BaseTransaction.java index f836decaa9..848900e8bd 100644 --- a/java/client/src/main/java/glide/api/models/BaseTransaction.java +++ b/java/client/src/main/java/glide/api/models/BaseTransaction.java @@ -9,6 +9,7 @@ import static glide.api.commands.SortedSetBaseCommands.WITH_SCORES_REDIS_API; import static glide.api.commands.SortedSetBaseCommands.WITH_SCORE_REDIS_API; import static glide.api.models.commands.RangeOptions.createZRangeArgs; +import static glide.api.models.commands.function.FunctionLoadOptions.REPLACE; import static glide.utils.ArrayTransformUtils.concatenateArrays; import static glide.utils.ArrayTransformUtils.convertMapToKeyValueStringArray; import static glide.utils.ArrayTransformUtils.convertMapToValueKeyStringArray; @@ -176,7 +177,6 @@ import glide.api.models.commands.ZAddOptions; import glide.api.models.commands.bitmap.BitmapIndexType; import glide.api.models.commands.bitmap.BitwiseOperation; -import glide.api.models.commands.function.FunctionLoadOptions; import glide.api.models.commands.geospatial.GeoAddOptions; import glide.api.models.commands.geospatial.GeoUnit; import glide.api.models.commands.geospatial.GeospatialData; @@ -3426,30 +3426,17 @@ public T geohash(@NonNull String key, @NonNull String[] members) { } /** - * Loads a library to Redis unless a library with the same name exists. Use {@link - * #functionLoadReplace} to replace existing libraries. + * Loads a library to Redis unless a library with the same name exists. * * @since Redis 7.0 and above. * @see redis.io for details. * @param libraryCode The source code that implements the library. + * @param replace Whether new library overwrites a library with the same name if it exists. * @return Command Response - The library name that was loaded. */ - public T functionLoad(@NonNull String libraryCode) { - ArgsArray commandArgs = buildArgs(libraryCode); - protobufTransaction.addCommands(buildCommand(FunctionLoad, commandArgs)); - return getThis(); - } - - /** - * Loads a library to Redis and overwrites a library with the same name if it exists. - * - * @since Redis 7.0 and above. - * @see redis.io for details. - * @param libraryCode The source code that implements the library. - * @return Command Response - The library name that was loaded. - */ - public T functionLoadReplace(@NonNull String libraryCode) { - ArgsArray commandArgs = buildArgs(FunctionLoadOptions.REPLACE.toString(), libraryCode); + public T functionLoad(@NonNull String libraryCode, boolean replace) { + ArgsArray commandArgs = + replace ? buildArgs(REPLACE.toString(), libraryCode) : buildArgs(libraryCode); protobufTransaction.addCommands(buildCommand(FunctionLoad, commandArgs)); return getThis(); } diff --git a/java/client/src/test/java/glide/api/RedisClientTest.java b/java/client/src/test/java/glide/api/RedisClientTest.java index c864cf4138..b0559cfd4a 100644 --- a/java/client/src/test/java/glide/api/RedisClientTest.java +++ b/java/client/src/test/java/glide/api/RedisClientTest.java @@ -4698,7 +4698,7 @@ public void functionLoad_returns_success() { .thenReturn(testResponse); // exercise - CompletableFuture response = service.functionLoad(code); + CompletableFuture response = service.functionLoad(code, false); String payload = response.get(); // verify @@ -4708,7 +4708,7 @@ public void functionLoad_returns_success() { @SneakyThrows @Test - public void functionLoadReplace_returns_success() { + public void functionLoad_with_replace_returns_success() { // setup String code = "The best code ever"; String[] args = new String[] {FunctionLoadOptions.REPLACE.toString(), code}; @@ -4721,7 +4721,7 @@ public void functionLoadReplace_returns_success() { .thenReturn(testResponse); // exercise - CompletableFuture response = service.functionLoadReplace(code); + CompletableFuture response = service.functionLoad(code, true); String payload = response.get(); // verify diff --git a/java/client/src/test/java/glide/api/RedisClusterClientTest.java b/java/client/src/test/java/glide/api/RedisClusterClientTest.java index 01beb573bf..0af49287f8 100644 --- a/java/client/src/test/java/glide/api/RedisClusterClientTest.java +++ b/java/client/src/test/java/glide/api/RedisClusterClientTest.java @@ -1093,7 +1093,7 @@ public void functionLoad_returns_success() { .thenReturn(testResponse); // exercise - CompletableFuture response = service.functionLoad(code); + CompletableFuture response = service.functionLoad(code, false); String payload = response.get(); // verify @@ -1103,7 +1103,7 @@ public void functionLoad_returns_success() { @SneakyThrows @Test - public void functionLoadReplace_returns_success() { + public void functionLoad_with_replace_returns_success() { // setup String code = "The best code ever"; String[] args = new String[] {FunctionLoadOptions.REPLACE.toString(), code}; @@ -1116,7 +1116,7 @@ public void functionLoadReplace_returns_success() { .thenReturn(testResponse); // exercise - CompletableFuture response = service.functionLoadReplace(code); + CompletableFuture response = service.functionLoad(code, true); String payload = response.get(); // verify @@ -1126,7 +1126,7 @@ public void functionLoadReplace_returns_success() { @SneakyThrows @Test - public void functionLoadWithRoute_returns_success() { + public void functionLoad_with_route_returns_success() { // setup String code = "The best code ever"; String[] args = new String[] {code}; @@ -1139,7 +1139,7 @@ public void functionLoadWithRoute_returns_success() { .thenReturn(testResponse); // exercise - CompletableFuture response = service.functionLoad(code, RANDOM); + CompletableFuture response = service.functionLoad(code, false, RANDOM); String payload = response.get(); // verify @@ -1149,7 +1149,7 @@ public void functionLoadWithRoute_returns_success() { @SneakyThrows @Test - public void functionLoadReplaceRoute_returns_success() { + public void functionLoad_with_replace_with_route_returns_success() { // setup String code = "The best code ever"; String[] args = new String[] {FunctionLoadOptions.REPLACE.toString(), code}; @@ -1162,7 +1162,7 @@ public void functionLoadReplaceRoute_returns_success() { .thenReturn(testResponse); // exercise - CompletableFuture response = service.functionLoadReplace(code, RANDOM); + CompletableFuture response = service.functionLoad(code, true, RANDOM); String payload = response.get(); // verify diff --git a/java/client/src/test/java/glide/api/models/TransactionTests.java b/java/client/src/test/java/glide/api/models/TransactionTests.java index 53a3dca6fe..8ee6e3fc00 100644 --- a/java/client/src/test/java/glide/api/models/TransactionTests.java +++ b/java/client/src/test/java/glide/api/models/TransactionTests.java @@ -807,7 +807,7 @@ InfScoreBound.NEGATIVE_INFINITY, new ScoreBoundary(3, false), new Limit(1, 2)), transaction.geopos("key", new String[] {"Place"}); results.add(Pair.of(GeoPos, buildArgs("key", "Place"))); - transaction.functionLoad("pewpew").functionLoadReplace("ololo"); + transaction.functionLoad("pewpew", false).functionLoad("ololo", true); results.add(Pair.of(FunctionLoad, buildArgs("pewpew"))); results.add(Pair.of(FunctionLoad, buildArgs("REPLACE", "ololo"))); diff --git a/java/integTest/src/test/java/glide/TransactionTestUtilities.java b/java/integTest/src/test/java/glide/TransactionTestUtilities.java index f7dddad6d7..54df793dfe 100644 --- a/java/integTest/src/test/java/glide/TransactionTestUtilities.java +++ b/java/integTest/src/test/java/glide/TransactionTestUtilities.java @@ -579,11 +579,11 @@ private static Object[] scriptingAndFunctionsCommands(BaseTransaction transac "#!lua name=mylib1T \n" + " redis.register_function('myfunc1T', function(keys, args) return args[1] end)"; - transaction.functionLoad(code).functionLoadReplace(code); + transaction.functionLoad(code, false).functionLoad(code, true); return new Object[] { - "mylib1T", // functionLoad(code) - "mylib1T" // functionLoadReplace(code) + "mylib1T", // functionLoad(code, false) + "mylib1T", // functionLoad(code, true) }; } diff --git a/java/integTest/src/test/java/glide/cluster/CommandTests.java b/java/integTest/src/test/java/glide/cluster/CommandTests.java index cf68903d74..7d5986b4f8 100644 --- a/java/integTest/src/test/java/glide/cluster/CommandTests.java +++ b/java/integTest/src/test/java/glide/cluster/CommandTests.java @@ -781,14 +781,18 @@ public void functionLoad(boolean withRoute) { Route route = new SlotKeyRoute("1", PRIMARY); var promise = - withRoute ? clusterClient.functionLoad(code, route) : clusterClient.functionLoad(code); + withRoute + ? clusterClient.functionLoad(code, false, route) + : clusterClient.functionLoad(code, false); assertEquals(libName, promise.get()); // TODO test function with FCALL when fixed in redis-rs and implemented // TODO test with FUNCTION LIST // re-load library without overwriting promise = - withRoute ? clusterClient.functionLoad(code, route) : clusterClient.functionLoad(code); + withRoute + ? clusterClient.functionLoad(code, false, route) + : clusterClient.functionLoad(code, false); var executionException = assertThrows(ExecutionException.class, promise::get); assertInstanceOf(RequestException.class, executionException.getCause()); assertTrue( @@ -797,8 +801,8 @@ public void functionLoad(boolean withRoute) { // re-load library with overwriting var promise2 = withRoute - ? clusterClient.functionLoadReplace(code, route) - : clusterClient.functionLoadReplace(code); + ? clusterClient.functionLoad(code, true, route) + : clusterClient.functionLoad(code, true); assertEquals(libName, promise2.get()); String newCode = code @@ -807,8 +811,8 @@ public void functionLoad(boolean withRoute) { + "', function(keys, args) return #args end)"; promise2 = withRoute - ? clusterClient.functionLoadReplace(newCode, route) - : clusterClient.functionLoadReplace(newCode); + ? clusterClient.functionLoad(newCode, true, route) + : clusterClient.functionLoad(newCode, true); assertEquals(libName, promise2.get()); // TODO test with FCALL } diff --git a/java/integTest/src/test/java/glide/standalone/CommandTests.java b/java/integTest/src/test/java/glide/standalone/CommandTests.java index 5426796d27..079b0593fb 100644 --- a/java/integTest/src/test/java/glide/standalone/CommandTests.java +++ b/java/integTest/src/test/java/glide/standalone/CommandTests.java @@ -346,22 +346,22 @@ public void functionLoad() { "#!lua name=" + libName + " \n redis.register_function('myfunc1c', function(keys, args) return args[1] end)"; - assertEquals(libName, regularClient.functionLoad(code).get()); + assertEquals(libName, regularClient.functionLoad(code, false).get()); // TODO test function with FCALL when fixed in redis-rs and implemented // TODO test with FUNCTION LIST // re-load library without overwriting var executionException = - assertThrows(ExecutionException.class, () -> regularClient.functionLoad(code).get()); + assertThrows(ExecutionException.class, () -> regularClient.functionLoad(code, false).get()); assertInstanceOf(RequestException.class, executionException.getCause()); assertTrue( executionException.getMessage().contains("Library '" + libName + "' already exists")); // re-load library with overwriting - assertEquals(libName, regularClient.functionLoadReplace(code).get()); + assertEquals(libName, regularClient.functionLoad(code, true).get()); String newCode = code + "\n redis.register_function('myfunc2c', function(keys, args) return #args end)"; - assertEquals(libName, regularClient.functionLoadReplace(newCode).get()); + assertEquals(libName, regularClient.functionLoad(newCode, true).get()); // TODO test with FCALL } } From cfeda0c6e4e00b01cf30400bdabb0c12ad8f4656 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Tue, 28 May 2024 12:41:24 -0700 Subject: [PATCH 2/5] Apply suggestions from code review Signed-off-by: Yury-Fridlyand Co-authored-by: Aaron <69273634+aaron-congo@users.noreply.github.com> --- .../api/commands/ScriptingAndFunctionsClusterCommands.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java b/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java index db01795e84..7c4577f271 100644 --- a/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java +++ b/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java @@ -13,13 +13,13 @@ public interface ScriptingAndFunctionsClusterCommands { /** - * Loads a library to Redis unless a library with the same name exists.
+ * Loads a library to Redis.
* The command will be routed to all primary nodes. * * @since Redis 7.0 and above. * @see redis.io for details. * @param libraryCode The source code that implements the library. - * @param replace Whether new library overwrites a library with the same name if it exists. + * @param replace Whether the given library should overwrite a library with the same name if it already exists. * @return The library name that was loaded. * @example *
{@code

From cb52080baa1170044361f6db11ba5fe5e164b997 Mon Sep 17 00:00:00 2001
From: Yury-Fridlyand 
Date: Tue, 28 May 2024 12:42:36 -0700
Subject: [PATCH 3/5] I HATE YOU SPOTLESS

Signed-off-by: Yury-Fridlyand 
---
 .../api/commands/ScriptingAndFunctionsClusterCommands.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java b/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
index 7c4577f271..1342281d74 100644
--- a/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
+++ b/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
@@ -19,7 +19,8 @@ public interface ScriptingAndFunctionsClusterCommands {
      * @since Redis 7.0 and above.
      * @see redis.io for details.
      * @param libraryCode The source code that implements the library.
-     * @param replace Whether the given library should overwrite a library with the same name if it already exists.
+     * @param replace Whether the given library should overwrite a library with the same name if it
+     *     already exists.
      * @return The library name that was loaded.
      * @example
      *     
{@code

From 9c6aa5629dd3d7222c7493d511b93bb7b369e64d Mon Sep 17 00:00:00 2001
From: Yury-Fridlyand 
Date: Tue, 28 May 2024 15:03:02 -0700
Subject: [PATCH 4/5] Add missing update.

Signed-off-by: Yury-Fridlyand 
---
 .../api/commands/ScriptingAndFunctionsClusterCommands.java   | 5 +++--
 .../glide/api/commands/ScriptingAndFunctionsCommands.java    | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java b/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
index 1342281d74..0df7077f4f 100644
--- a/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
+++ b/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
@@ -32,12 +32,13 @@ public interface ScriptingAndFunctionsClusterCommands {
     CompletableFuture functionLoad(String libraryCode, boolean replace);
 
     /**
-     * Loads a library to Redis unless a library with the same name exists.
+     * Loads a library to Redis.
      *
      * @since Redis 7.0 and above.
      * @see redis.io for details.
      * @param libraryCode The source code that implements the library.
-     * @param replace Whether new library overwrites a library with the same name if it exists.
+     * @param replace Whether the given library should overwrite a library with the same name if it
+     *     already exists.
      * @param route Specifies the routing configuration for the command. The client will route the
      *     command to the nodes defined by route.
      * @return The library name that was loaded.
diff --git a/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsCommands.java b/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsCommands.java
index 813f21ddb0..3da638d998 100644
--- a/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsCommands.java
+++ b/java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsCommands.java
@@ -13,12 +13,13 @@
 public interface ScriptingAndFunctionsCommands {
 
     /**
-     * Loads a library to Redis unless a library with the same name exists.
+     * Loads a library to Redis.
      *
      * @since Redis 7.0 and above.
      * @see redis.io for details.
      * @param libraryCode The source code that implements the library.
-     * @param replace Whether new library overwrites a library with the same name if it exists.
+     * @param replace Whether the given library should overwrite a library with the same name if it
+     *     already exists.
      * @return The library name that was loaded.
      * @example
      *     
{@code

From 8c77b375cf49220153cd6753923d935eb3852863 Mon Sep 17 00:00:00 2001
From: Yury-Fridlyand 
Date: Tue, 28 May 2024 15:03:29 -0700
Subject: [PATCH 5/5] Add missing update.

Signed-off-by: Yury-Fridlyand 
---
 .../src/main/java/glide/api/models/BaseTransaction.java      | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/java/client/src/main/java/glide/api/models/BaseTransaction.java b/java/client/src/main/java/glide/api/models/BaseTransaction.java
index 848900e8bd..adac388126 100644
--- a/java/client/src/main/java/glide/api/models/BaseTransaction.java
+++ b/java/client/src/main/java/glide/api/models/BaseTransaction.java
@@ -3426,12 +3426,13 @@ public T geohash(@NonNull String key, @NonNull String[] members) {
     }
 
     /**
-     * Loads a library to Redis unless a library with the same name exists.
+     * Loads a library to Redis.
      *
      * @since Redis 7.0 and above.
      * @see redis.io for details.
      * @param libraryCode The source code that implements the library.
-     * @param replace Whether new library overwrites a library with the same name if it exists.
+     * @param replace Whether the given library should overwrite a library with the same name if it
+     *     already exists.
      * @return Command Response - The library name that was loaded.
      */
     public T functionLoad(@NonNull String libraryCode, boolean replace) {