Skip to content

Commit 71cd5f1

Browse files
zeeklingsazzad16
andauthored
support jedis migrate keys encoded by gdk (#2689)
* support jedis migrate keys encoded by gdk failed * Rename method clusterGetBytesKeysInSlot to clusterGetKeysInSlotBinary. * clusterGetKeysInSlotBinary test name * fix test exec failed Co-authored-by: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com>
1 parent b82967a commit 71cd5f1

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

src/main/java/redis/clients/jedis/Jedis.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3888,6 +3888,13 @@ public List<String> clusterGetKeysInSlot(final int slot, final int count) {
38883888
return client.getMultiBulkReply();
38893889
}
38903890

3891+
@Override
3892+
public List<byte[]> clusterGetKeysInSlotBinary(final int slot, final int count) {
3893+
checkIsInMultiOrPipeline();
3894+
client.clusterGetKeysInSlot(slot, count);
3895+
return client.getBinaryMultiBulkReply();
3896+
}
3897+
38913898
@Override
38923899
public String clusterSetSlotNode(final int slot, final String nodeId) {
38933900
checkIsInMultiOrPipeline();

src/main/java/redis/clients/jedis/commands/ClusterCommands.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public interface ClusterCommands {
2626

2727
List<String> clusterGetKeysInSlot(int slot, int count);
2828

29+
List<byte[]> clusterGetKeysInSlotBinary(int slot, int count);
30+
2931
String clusterSetSlotNode(int slot, String nodeId);
3032

3133
String clusterSetSlotMigrating(int slot, String nodeId);

src/main/java/redis/clients/jedis/commands/Commands.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,10 @@ default void restoreReplace(String key, int ttl, byte[] serializedValue) {
475475

476476
void migrate(String host, int port, int destinationDB, int timeout, MigrateParams params, String... keys);
477477

478+
void migrate(String host, int port, byte[] key, int destinationDB, int timeout);
479+
480+
void migrate(String host, int port, int destinationDB, int timeout, MigrateParams params, byte[]... keys);
481+
478482
void clientKill(String ipPort);
479483

480484
void clientKill(String ip, int port);

src/test/java/redis/clients/jedis/tests/commands/ClusterCommandsTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ public void clusterGetKeysInSlot() {
129129
assertEquals(0, keys.size());
130130
}
131131

132+
@Test
133+
public void clusterGetKeysInSlotBinary() {
134+
node1.clusterAddSlots(501);
135+
List<byte[]> keys = node1.clusterGetKeysInSlotBinary(501, 1);
136+
assertEquals(0, keys.size());
137+
}
138+
132139
@Test
133140
public void clusterSetSlotNode() {
134141
String[] nodes = node1.clusterNodes().split("\n");

0 commit comments

Comments
 (0)