Fixed - Spring Data Redis module. Scan In cluster mode, other nodes cannot be scanned #4238

pull/4272/head
Nikita Koksharov 3 years ago
parent bb3e929cb8
commit 347e0dd371

@ -278,6 +278,7 @@ public class RedissonConnection extends AbstractRedisConnection {
if (entries.hasNext()) {
pos = -1;
entry = entries.next();
client = null;
} else {
entry = null;
}

@ -297,6 +297,7 @@ public class RedissonConnection extends AbstractRedisConnection {
if (entries.hasNext()) {
pos = -1;
entry = entries.next();
client = null;
} else {
entry = null;
}

@ -300,6 +300,7 @@ public class RedissonConnection extends AbstractRedisConnection {
if (entries.hasNext()) {
pos = -1;
entry = entries.next();
client = null;
} else {
entry = null;
}

@ -282,6 +282,7 @@ public class RedissonConnection extends AbstractRedisConnection {
if (entries.hasNext()) {
pos = -1;
entry = entries.next();
client = null;
} else {
entry = null;
}

@ -280,6 +280,7 @@ public class RedissonConnection extends AbstractRedisConnection {
if (entries.hasNext()) {
pos = -1;
entry = entries.next();
client = null;
} else {
entry = null;
}

@ -280,6 +280,7 @@ public class RedissonConnection extends AbstractRedisConnection {
if (entries.hasNext()) {
pos = -1;
entry = entries.next();
client = null;
} else {
entry = null;
}

@ -280,6 +280,7 @@ public class RedissonConnection extends AbstractRedisConnection {
if (entries.hasNext()) {
pos = -1;
entry = entries.next();
client = null;
} else {
entry = null;
}

@ -280,6 +280,7 @@ public class RedissonConnection extends AbstractRedisConnection {
if (entries.hasNext()) {
pos = -1;
entry = entries.next();
client = null;
} else {
entry = null;
}

@ -280,6 +280,7 @@ public class RedissonConnection extends AbstractRedisConnection {
if (entries.hasNext()) {
pos = -1;
entry = entries.next();
client = null;
} else {
entry = null;
}

@ -280,6 +280,7 @@ public class RedissonConnection extends AbstractRedisConnection {
if (entries.hasNext()) {
pos = -1;
entry = entries.next();
client = null;
} else {
entry = null;
}

@ -17,9 +17,12 @@ import org.springframework.data.redis.connection.ClusterInfo;
import org.springframework.data.redis.connection.RedisClusterNode;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.RedisNode.NodeType;
import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.*;
import static org.assertj.core.api.Assertions.assertThat;
@ -73,6 +76,21 @@ public class RedissonClusterConnectionTest {
assertThat(connection.del(keys.toArray(new byte[0][]))).isEqualTo(10);
}
@Test
public void testScan() {
for (int i = 0; i < 1000; i++) {
connection.set(("" + i).getBytes(StandardCharsets.UTF_8), ("" + i).getBytes(StandardCharsets.UTF_8));
}
Cursor<byte[]> b = connection.scan(ScanOptions.scanOptions().build());
int counter = 0;
while (b.hasNext()) {
b.next();
counter++;
}
assertThat(counter).isEqualTo(1000);
}
@Test
public void testMSet() {
Map<byte[], byte[]> map = new HashMap<>();

Loading…
Cancel
Save