From 7fbf9cb8a30060bd6a9f27f7728e6706c800caf3 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 23 Apr 2020 15:43:48 +0200 Subject: [PATCH] Enable Stream commands for read-only routing #1271 XINFO, XLEN, XPENDING, XRANGE, XREVRANGE, and XREAD can now be issued to replicas. --- src/main/java/io/lettuce/core/cluster/ReadOnlyCommands.java | 4 +++- .../java/io/lettuce/core/masterreplica/ReadOnlyCommands.java | 4 +++- .../io/lettuce/core/cluster/ReadOnlyCommandsUnitTests.java | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/lettuce/core/cluster/ReadOnlyCommands.java b/src/main/java/io/lettuce/core/cluster/ReadOnlyCommands.java index 7eddc21180..5bb32db0c5 100644 --- a/src/main/java/io/lettuce/core/cluster/ReadOnlyCommands.java +++ b/src/main/java/io/lettuce/core/cluster/ReadOnlyCommands.java @@ -59,7 +59,9 @@ enum CommandName { HVALS, INFO, KEYS, LINDEX, LLEN, LRANGE, MGET, PFCOUNT, PTTL, // RANDOMKEY, READWRITE, SCAN, SCARD, SCRIPT, // SDIFF, SINTER, SISMEMBER, SMEMBERS, SRANDMEMBER, SSCAN, STRLEN, // - SUNION, TIME, TTL, TYPE, ZCARD, ZCOUNT, ZLEXCOUNT, ZRANGE, // + SUNION, TIME, TTL, TYPE, // + XINFO, XLEN, XPENDING, XRANGE, XREVRANGE, XREAD, // + ZCARD, ZCOUNT, ZLEXCOUNT, ZRANGE, // 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 diff --git a/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java b/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java index 380542cd93..eaecd0d793 100644 --- a/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java +++ b/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java @@ -59,7 +59,9 @@ enum CommandName { HVALS, INFO, KEYS, LINDEX, LLEN, LRANGE, MGET, PFCOUNT, PTTL, // RANDOMKEY, READWRITE, SCAN, SCARD, SCRIPT, // SDIFF, SINTER, SISMEMBER, SMEMBERS, SRANDMEMBER, SSCAN, STRLEN, // - SUNION, TIME, TTL, TYPE, ZCARD, ZCOUNT, ZLEXCOUNT, ZRANGE, // + SUNION, TIME, TTL, TYPE, // + XINFO, XLEN, XPENDING, XRANGE, XREVRANGE, XREAD, // + ZCARD, ZCOUNT, ZLEXCOUNT, ZRANGE, // 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 ef8bb5d619..545e46aa55 100644 --- a/src/test/java/io/lettuce/core/cluster/ReadOnlyCommandsUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/ReadOnlyCommandsUnitTests.java @@ -29,7 +29,7 @@ class ReadOnlyCommandsUnitTests { @Test void testCount() { - assertThat(ReadOnlyCommands.getReadOnlyCommands()).hasSize(70); + assertThat(ReadOnlyCommands.getReadOnlyCommands()).hasSize(76); } @Test