From ce1231da95166d5e165f9fd263639e09536b6262 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 4 Mar 2021 13:40:46 +0100 Subject: [PATCH] Polishing #1605 Include HRANDFIELD and ZRANDMEMBER as read-only commands. --- src/main/java/io/lettuce/core/cluster/ReadOnlyCommands.java | 4 ++-- .../java/io/lettuce/core/masterreplica/ReadOnlyCommands.java | 4 ++-- .../io/lettuce/core/cluster/ReadOnlyCommandsUnitTests.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/io/lettuce/core/cluster/ReadOnlyCommands.java b/src/main/java/io/lettuce/core/cluster/ReadOnlyCommands.java index 347d15d469..8af19cb092 100644 --- a/src/main/java/io/lettuce/core/cluster/ReadOnlyCommands.java +++ b/src/main/java/io/lettuce/core/cluster/ReadOnlyCommands.java @@ -55,14 +55,14 @@ public static Set getReadOnlyCommands() { enum CommandName { ASKING, BITCOUNT, BITPOS, CLIENT, COMMAND, DUMP, ECHO, EVAL, EVALSHA, EXISTS, // GEODIST, GEOPOS, GEORADIUS, GEORADIUS_RO, GEORADIUSBYMEMBER, GEORADIUSBYMEMBER_RO, GEOHASH, GET, GETBIT, // - GETRANGE, HEXISTS, HGET, HGETALL, HKEYS, HLEN, HMGET, HSCAN, HSTRLEN, // + GETRANGE, HEXISTS, HGET, HGETALL, HKEYS, HLEN, HMGET, HRANDFIELD, HSCAN, HSTRLEN, // HVALS, INFO, KEYS, LINDEX, LLEN, LPOS, LRANGE, MGET, PFCOUNT, PTTL, // RANDOMKEY, READWRITE, SCAN, SCARD, SCRIPT, // SDIFF, SINTER, SISMEMBER, SMEMBERS, SRANDMEMBER, SSCAN, STRLEN, // SUNION, TIME, TTL, TYPE, // XINFO, XLEN, XPENDING, XRANGE, XREVRANGE, XREAD, // ZCARD, ZCOUNT, ZLEXCOUNT, ZRANGE, // - ZRANGEBYLEX, ZRANGEBYSCORE, ZRANK, ZREVRANGE, ZREVRANGEBYLEX, ZREVRANGEBYSCORE, ZREVRANK, ZSCAN, ZSCORE, // + ZRANDMEMBER, ZRANGEBYLEX, ZRANGEBYSCORE, ZRANK, ZREVRANGE, ZREVRANGEBYLEX, ZREVRANGEBYSCORE, ZREVRANK, ZSCAN, ZSCORE, // // Pub/Sub commands are no key-space commands so they are safe to execute on replica nodes PUBLISH, PUBSUB, PSUBSCRIBE, PUNSUBSCRIBE, SUBSCRIBE, UNSUBSCRIBE diff --git a/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java b/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java index e677db1d4c..51bbca4476 100644 --- a/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java +++ b/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java @@ -55,14 +55,14 @@ public static Set getReadOnlyCommands() { enum CommandName { ASKING, BITCOUNT, BITPOS, CLIENT, COMMAND, DUMP, ECHO, EVAL, EVALSHA, EXISTS, // GEODIST, GEOPOS, GEORADIUS, GEORADIUSBYMEMBER, GEOHASH, GET, GETBIT, // - GETRANGE, HEXISTS, HGET, HGETALL, HKEYS, HLEN, HMGET, HSCAN, HSTRLEN, // + GETRANGE, HEXISTS, HGET, HGETALL, HKEYS, HLEN, HMGET, HRANDFIELD, HSCAN, HSTRLEN, // HVALS, INFO, KEYS, LINDEX, LLEN, LPOS, LRANGE, MGET, PFCOUNT, PTTL, // RANDOMKEY, READWRITE, SCAN, SCARD, SCRIPT, // SDIFF, SINTER, SISMEMBER, SMEMBERS, SRANDMEMBER, SSCAN, STRLEN, // SUNION, TIME, TTL, TYPE, // XINFO, XLEN, XPENDING, XRANGE, XREVRANGE, XREAD, // ZCARD, ZCOUNT, ZLEXCOUNT, ZRANGE, // - ZRANGEBYLEX, ZRANGEBYSCORE, ZRANK, ZREVRANGE, ZREVRANGEBYLEX, ZREVRANGEBYSCORE, ZREVRANK, ZSCAN, ZSCORE, + ZRANDMEMBER, ZRANGEBYLEX, ZRANGEBYSCORE, ZRANK, ZREVRANGE, ZREVRANGEBYLEX, ZREVRANGEBYSCORE, ZREVRANK, ZSCAN, ZSCORE, } } diff --git a/src/test/java/io/lettuce/core/cluster/ReadOnlyCommandsUnitTests.java b/src/test/java/io/lettuce/core/cluster/ReadOnlyCommandsUnitTests.java index 50e690a73c..904d9d74b3 100644 --- a/src/test/java/io/lettuce/core/cluster/ReadOnlyCommandsUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/ReadOnlyCommandsUnitTests.java @@ -15,7 +15,7 @@ */ package io.lettuce.core.cluster; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; import org.junit.jupiter.api.Test; @@ -31,7 +31,7 @@ class ReadOnlyCommandsUnitTests { @Test void testCount() { - assertThat(ReadOnlyCommands.getReadOnlyCommands()).hasSize(79); + assertThat(ReadOnlyCommands.getReadOnlyCommands()).hasSize(81); } @Test