diff --git a/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/enums/RedisCommand.java b/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/enums/RedisCommand.java index b8f08225a..3f11596d6 100644 --- a/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/enums/RedisCommand.java +++ b/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/enums/RedisCommand.java @@ -75,6 +75,7 @@ public enum RedisCommand { ZCARD(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.ZSET, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), ZSCORE(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.ZSET, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), SORT(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.DB, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), + SORT_RO(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.DB, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), ZCOUNT(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.ZSET, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), ZRANGE(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.ZSET, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), ZRANGEBYSCORE(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.ZSET, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), @@ -120,6 +121,7 @@ public enum RedisCommand { GEORADIUSBYMEMBER(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.GE0, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), GEOSEARCH(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.GE0, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), BITFIELD(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.STRING, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), + BITFIELD_RO(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.STRING, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), ECHO(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.DB, Blocking.FALSE, CommandKeyType.None), PFADD(CommandSupportType.FULL_SUPPORT, Type.WRITE, CommandType.HYPER_LOG_LOG, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), XACK(CommandSupportType.FULL_SUPPORT, Type.WRITE, CommandType.STREAM, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), @@ -229,6 +231,8 @@ public enum RedisCommand { JSON_STRLEN(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.JSON, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), JSON_TOGGLE(CommandSupportType.FULL_SUPPORT, Type.WRITE, CommandType.JSON, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), JSON_TYPE(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.JSON, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), + EXPIRETIME(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.DB, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), + PEXPIRETIME(CommandSupportType.FULL_SUPPORT, Type.READ, CommandType.DB, Blocking.FALSE, CommandKeyType.SIMPLE_SINGLE), /** * Restrictive Support @@ -290,6 +294,8 @@ public enum RedisCommand { TFCALL(CommandSupportType.RESTRICTIVE_SUPPORT, Type.WRITE, CommandType.TFUNCTION, Blocking.FALSE, CommandKeyType.COMPLEX), TFCALLASYNC(CommandSupportType.RESTRICTIVE_SUPPORT, Type.WRITE, CommandType.TFUNCTION, Blocking.FALSE, CommandKeyType.COMPLEX), TFUNCTION(CommandSupportType.RESTRICTIVE_SUPPORT, Type.WRITE, CommandType.TFUNCTION, Blocking.FALSE, CommandKeyType.None), + SINTERCARD(CommandSupportType.RESTRICTIVE_SUPPORT, Type.READ, CommandType.SET, Blocking.FALSE, CommandKeyType.COMPLEX), + LCS(CommandSupportType.RESTRICTIVE_SUPPORT, Type.READ, CommandType.STRING, Blocking.FALSE, CommandKeyType.COMPLEX), /** * Partially Support-1 diff --git a/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/plugin/converter/Converters.java b/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/plugin/converter/Converters.java index 79179e3b3..4893491ba 100644 --- a/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/plugin/converter/Converters.java +++ b/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/plugin/converter/Converters.java @@ -172,6 +172,7 @@ private void keyConvert(RedisCommand redisCommand, CommandContext commandContext case LMOVE: case ZRANGESTORE: case BLMOVE: + case LCS: if (command.getObjects().length >= 3) { byte[] convertedKey1 = convert(commandContext, redisCommand, objects[1], convert); objects[1] = convertedKey1; @@ -207,6 +208,7 @@ private void keyConvert(RedisCommand redisCommand, CommandContext commandContext case EXZINTERCARD: case ZMPOP: case LMPOP: + case SINTERCARD: if (objects.length >= 3) { int keyCount2 = (int) Utils.bytesToNum(objects[1]); if (keyCount2 > 0) { diff --git a/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/util/KeyParser.java b/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/util/KeyParser.java index 21df5db4c..dee462578 100644 --- a/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/util/KeyParser.java +++ b/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/util/KeyParser.java @@ -56,6 +56,7 @@ public static List findKeys(Command command) { case LMOVE: case ZRANGESTORE: case BLMOVE: + case LCS: if (command.getObjects().length >= 3) { dynamicKey(command, keys, 1, 2); } @@ -84,6 +85,7 @@ public static List findKeys(Command command) { case EXZINTERCARD: case ZMPOP: case LMPOP: + case SINTERCARD: if (objects.length >= 3) { int keyCount = (int) Utils.bytesToNum(objects[1]); if (keyCount > 0) { diff --git a/docs/redis-proxy/redis-proxy-en.md b/docs/redis-proxy/redis-proxy-en.md index eeb1cbf29..a717b562a 100644 --- a/docs/redis-proxy/redis-proxy-en.md +++ b/docs/redis-proxy/redis-proxy-en.md @@ -34,7 +34,7 @@ camellia-redis-proxy is a high performance proxy for redis, which base on netty4 ``` ##DataBase PING,AUTH,HELLO,ECHO,QUIT,EXISTS,DEL,TYPE,EXPIRE, -EXPIREAT,TTL,PERSIST,PEXPIRE,PEXPIREAT,PTTL,SORT,UNLINK,TOUCH,DUMP,RESTORE,SCAN,COMMAND,CONFIG, +EXPIREAT,TTL,PERSIST,PEXPIRE,PEXPIREAT,PTTL,SORT,UNLINK,TOUCH,DUMP,RESTORE,SCAN,COMMAND,CONFIG,EXPIRETIME,PEXPIRETIME,SORT_RO, ##String SET,GET,GETSET,MGET,SETNX,SETEX,MSET,DECRBY,DECR,INCRBY,INCR,APPEND, STRLEN,INCRBYFLOAT,PSETEX,SETRANGE,GETRANGE,SUBSTR,GETEX,GETDEL, @@ -51,7 +51,7 @@ ZREVRANK,ZREVRANGE,ZREVRANGEBYSCORE,ZREVRANGEBYLEX,ZREM, ZREMRANGEBYRANK,ZREMRANGEBYSCORE,ZREMRANGEBYLEX,ZLEXCOUNT,ZSCAN, ZPOPMAX,ZPOPMIN,ZMSCORE,ZRANDMEMBER, ##BitMap -SETBIT,GETBIT,BITPOS,BITCOUNT,BITFIELD, +SETBIT,GETBIT,BITPOS,BITCOUNT,BITFIELD,BITFIELD_RO, ##Geo GEOADD,GEODIST,GEOHASH,GEOPOS,GEORADIUS,GEORADIUSBYMEMBER,GEOSEARCH, ##HyperLogLog @@ -83,9 +83,9 @@ especially, blocking command don't support multi-write ##DataBase RENAME,RENAMENX, ##String -MSETNX, +MSETNX,LCS, ##Set -SINTER,SINTERSTORE,SUNION,SUNIONSTORE,SDIFF,SDIFFSTORE,SMOVE, +SINTER,SINTERSTORE,SUNION,SUNIONSTORE,SDIFF,SDIFFSTORE,SMOVE,SINTERCARD ##List BLPOP,BRPOP,RPOPLPUSH,BRPOPLPUSH,LMOVE,BLMOVE,LMPOP,BLMPOP, ##ZSet diff --git a/docs/redis-proxy/redis-proxy-zh.md b/docs/redis-proxy/redis-proxy-zh.md index 3f3553d41..5094085e3 100644 --- a/docs/redis-proxy/redis-proxy-zh.md +++ b/docs/redis-proxy/redis-proxy-zh.md @@ -40,7 +40,7 @@ camellia-redis-proxy是一款高性能的redis代理,使用netty4开发 ``` ##DataBase PING,AUTH,HELLO,ECHO,QUIT,EXISTS,DEL,TYPE,EXPIRE, -EXPIREAT,TTL,PERSIST,PEXPIRE,PEXPIREAT,PTTL,SORT,UNLINK,TOUCH,DUMP,RESTORE,SCAN,COMMAND, +EXPIREAT,TTL,PERSIST,PEXPIRE,PEXPIREAT,PTTL,SORT,UNLINK,TOUCH,DUMP,RESTORE,SCAN,COMMAND,CONFIG,EXPIRETIME,PEXPIRETIME,SORT_RO, ##String SET,GET,GETSET,MGET,SETNX,SETEX,MSET,DECRBY,DECR,INCRBY,INCR,APPEND, STRLEN,INCRBYFLOAT,PSETEX,SETRANGE,GETRANGE,SUBSTR,GETEX,GETDEL, @@ -57,7 +57,7 @@ ZREVRANK,ZREVRANGE,ZREVRANGEBYSCORE,ZREVRANGEBYLEX,ZREM, ZREMRANGEBYRANK,ZREMRANGEBYSCORE,ZREMRANGEBYLEX,ZLEXCOUNT,ZSCAN, ZPOPMAX,ZPOPMIN,ZMSCORE,ZRANDMEMBER, ##BitMap -SETBIT,GETBIT,BITPOS,BITCOUNT,BITFIELD, +SETBIT,GETBIT,BITPOS,BITCOUNT,BITFIELD,BITFIELD_RO, ##Geo GEOADD,GEODIST,GEOHASH,GEOPOS,GEORADIUS,GEORADIUSBYMEMBER,GEOSEARCH, ##HyperLogLog @@ -89,9 +89,9 @@ JSON.RESP,JSON.SET,JSON.STRAPPEND,JSON.STRLEN,JSON.TOGGLE,JSON.TYPE, ##DataBase RENAME,RENAMENX, ##String -MSETNX, +MSETNX,LCS, ##Set -SINTER,SINTERSTORE,SUNION,SUNIONSTORE,SDIFF,SDIFFSTORE,SMOVE, +SINTER,SINTERSTORE,SUNION,SUNIONSTORE,SDIFF,SDIFFSTORE,SMOVE,SINTERCARD ##List BLPOP,BRPOP,RPOPLPUSH,BRPOPLPUSH,LMOVE,BLMOVE,LMPOP,BLMPOP, ##ZSet diff --git a/update-en.md b/update-en.md index 81c9016c4..837b490a9 100644 --- a/update-en.md +++ b/update-en.md @@ -9,12 +9,14 @@ * camellia-redis-proxy support shard-pubsub, support `SSUBSCRIBE/SUNSUBSCRIBE/SPUBLISH` commands * camellia-redis-proxy support `FUNCTION/TFUNCTION` commands * camellia-redis-proxy support `SCRIPT KILL` command +* camellia-redis-proxy support `EXPIRETIME/PEXPIRETIME/LCS/SINTERCARD/SORT_RO/BITFIELD_RO` commands ### update * none ### fix -* camellia-redis-proxy,eval_ro/evalsha_ro commands do not route correct when upstream route is custom-sharding or redis-cluster +* camellia-redis-proxy,eval_ro/evalsha_ro commands do not route correct when upstream route is custom-sharding or redis-cluster +* camellia-redis-proxy,eval/eval_sha/eval_ro/evasha_ro, if num-keys is 0 and upstream route is redis-cluster, return error reply # 1.2.18(2023/10/25) diff --git a/update-zh.md b/update-zh.md index d34ca921b..3dd31fd1a 100644 --- a/update-zh.md +++ b/update-zh.md @@ -9,12 +9,14 @@ * camellia-redis-proxy支持shard-pubsub,也就是支持`SSUBSCRIBE/SUNSUBSCRIBE/SPUBLISH`命令 * camellia-redis-proxy支持`FUNCTION/TFUNCTION`相关命令 * camellia-redis-proxy支持`SCRIPT KILL`命令 +* camellia-redis-proxy支持`EXPIRETIME/PEXPIRETIME/LCS/SINTERCARD/SORT_RO/BITFIELD_RO`命令 ### 更新 * 无 ### fix * camellia-redis-proxy,eval_ro和evalsha_ro命令在后端是自定义分片或者redis-cluster时,没有正确路由的问题 +* camellia-redis-proxy,使用eval/eval_sha/eval_ro/evasha_ro时,如果key数量为0,且后端是redis-cluster时,返回slot错误的问题 # 1.2.18(2023/10/25)