Skip to content

Commit

Permalink
support new commands of redis7.0 (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
caojiajun committed Nov 6, 2023
1 parent 5298084 commit 9ae2114
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static List<byte[]> findKeys(Command command) {
case LMOVE:
case ZRANGESTORE:
case BLMOVE:
case LCS:
if (command.getObjects().length >= 3) {
dynamicKey(command, keys, 1, 2);
}
Expand Down Expand Up @@ -84,6 +85,7 @@ public static List<byte[]> 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) {
Expand Down
8 changes: 4 additions & 4 deletions docs/redis-proxy/redis-proxy-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/redis-proxy/redis-proxy-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion update-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions update-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9ae2114

Please sign in to comment.