Redis Cloud 更改日志(2023 年 3 月)

2023 年 3 月期间向 Redis Cloud 添加了新功能、增强功能和其他更改。

Redis 云

此更改日志列出了 2023 年 3 月期间添加到 Redis Cloud 的新功能、增强功能和其他更改。

新增功能和增强功能

Redis 7.0 预览版

Redis 7.0 预览版可用于 AWS 和 GCP 中选定区域的固定订阅。但是,某些 Redis 7.0 功能在预览期间可能无法完全使用。Redis 7.0 还对现有 Redis 命令进行了几项更改;有关更多详细信息,请参阅重大更改列表

下表显示了 Redis 7.0 订阅支持哪些新的开源 Redis 7.0 命令。

集群管理命令

命令 支持
CLUSTER ADDSLOTSRANGE ❌ 不支持
CLUSTER DELSLOTSRANGE ❌ 不支持
群集链接 ❌ 不支持
集群分片 ❌ 不支持

连接管理命令

命令 支持
客户端 NO-EVICT ❌ 不支持

数据类型命令

数据类型 命令 支持
列表 BLMPOP ✅ 支持
列表 LMPOP ✅ 支持
设置 SINTERCARD 公司 ✅ 支持
排序集 BZMPOP 公司 ✅ 支持
排序集 ZINTERCARD 公司 ✅ 支持
排序集 BZMPOP 公司 ✅ 支持

Keys (通用) 命令

命令 支持
过期时间 ✅ 支持
PEXPIRETIME (预热时间) ✅ 支持
SORT_RO ✅ 支持

Pub/sub 命令

命令 支持
PUBSUB SHARDCHANNELS ✅ 支持
PUBSUB SHARDNUMSUB ✅ 支持
发布 ❌ 不支持
订阅 ❌ 不支持
SUNSUBSCRIBE 订阅 ❌ 不支持

脚本和函数命令

命令 支持
EVAL_RO ❌ 不支持
EVALSHA_RO ❌ 不支持
功能删除 ✅ 支持
函数转储 ✅ 支持
FLUSH 函数 ✅ 支持
功能帮助 ✅ 支持
KILL 函数 ✅ 支持
功能列表 ✅ 支持
函数负载 ✅ 支持
功能恢复 ✅ 支持
函数统计 ❌ 不支持

服务器管理命令

命令 支持
ACL DRYRUN ❌ 不支持
命令文档 ✅ 支持
命令 GETKEYSANDFLAGS ✅ 支持
命令列表 ✅ 支持
模块 LOADEX ❌ 不支持
延迟直方图 ❌ 不支持

重大更改

Redis 7.0 重大更改

当开源 Redis 的新主要版本更改现有命令时,将数据库升级到新版本可能会破坏某些功能。在升级之前,请务必阅读提供的影响 Redis Enterprise 的重大更改列表,并更新连接到数据库的任何应用程序以处理这些更改。

要检查您的 Redis 数据库版本 (redis_version),您可以使用 Admin Console 或运行INFOcommand 替换为redis-cli:

$ redis-cli -p <port> INFO
"# Server
redis_version:7.0.8
..."

Open source Redis version 7.0 introduces the following potentially breaking changes to Redis Enterprise:

Programmability

  • Lua scripts no longer have access to the print() function (#10651) - The print function was removed from Lua because it can potentially cause the Redis processes to get stuck (if no one reads from stdout). Users should use redis.log. An alternative is to override the print implementation and print the message to the log file.

  • Block PFCOUNT and PUBLISH in read-only scripts (*_RO commands, no-writes) (#10744) - Consider PFCOUNT and PUBLISH as write commands in scripts, in addition to EVAL; meaning:

    • They can never be used in scripts with shebang (#!) and no no-writes flag
    • They are blocked in EVAL_RO and _RO variants, (even in scripts without shebang (#!) flags)
    • Allow no-write scripts in EVAL (not just in EVAL_RO), even during CLIENT PAUSE WRITE
  • Hide the may_replicate flag from the COMMAND command response (#10744) - As part of the change to treat may_replicate commands PFCOUNT and PUBLISH as write commands in scripts, in addition to EVAL, the may_replicate flag has been removed from the COMMAND response.

Error handling

  • Rephrased some error responses about invalid commands or arguments (#10612) -

    • Error response for unknown command introduced a case change (Unknown to unknown)
    • Errors for module commands extended to cover subcommands, updated syntax to match Redis Server syntax
    • Arity errors for module commands introduce a case change (Wrong to wrong); will consider full command name
  • Corrected error codes returned from EVAL scripts (#10218, #10329).

    These examples show changes in behavior:

      1: config set maxmemory 1
      2: +OK
      3: eval "return redis.call('set','x','y')" 0
    - 4: -ERR Error running script (call to 71e6319f97b0fe8bdfa1c5df3ce4489946dda479): @user_script:1: @user_script: 1: -OOM command not allowed when used memory > 'maxmemory'.
    + 4: -ERR Error running script (call to 71e6319f97b0fe8bdfa1c5df3ce4489946dda479): @user_script:1: OOM command not allowed when used memory > 'maxmemory'.
      5: eval "return redis.pcall('set','x','y')" 0
    - 6: -@user_script: 1: -OOM command not allowed when used memory > 'maxmemory'.
    + 6: -OOM command not allowed when used memory > 'maxmemory'.
      7: eval "return redis.call('select',99)" 0
      8: -ERR Error running script (call to 4ad5abfc50bbccb484223905f9a16f09cd043ba8): @user_script:1: ERR DB index is out of range
      9: eval "return redis.pcall('select',99)" 0
     10: -ERR DB index is out of range
     11: eval_ro "return redis.call('set','x','y')" 0
    -12: -ERR Error running script (call to 71e6319f97b0fe8bdfa1c5df3ce4489946dda479): @user_script:1: @user_script: 1: Write commands are not allowed from read-only scripts.
    +12: -ERR Error running script (call to 71e6319f97b0fe8bdfa1c5df3ce4489946dda479): @user_script:1: ERR Write commands are not allowed from read-only scripts.
     13: eval_ro "return redis.pcall('set','x','y')" 0
    -14: -@user_script: 1: Write commands are not allowed from read-only scripts.
    +14: -ERR Write commands are not allowed from read-only scripts.
    
  • ZPOPMIN/ZPOPMAX used to produce wrong replies when count is 0 with non-zset #9711):

    • ZPOPMIN/ZPOPMAX used to produce an (empty array) when key was not a sorted set and the optional count argument was set to 0 and now produces a WRONGTYPE error response instead.
    • The optional count argument must be positive. A negative value produces a value is out of range error.

    These examples show changes in behavior:

      1: zadd myzset 1 "one"
      2: (integer) 1
      3: zadd myzset 2 "two"
      4: (integer) 1
      5: zadd myzset 3 "three"
      6: (integer) 1
      7: zpopmin myzset -1
    - 8: (empty array)
    + 8: (error) ERR value is out of range, must be positive
      9: 127.0.0.1:6379> set foo bar
     10: OK
     11: zpopmin foo 0
    -12: (empty array)
    +12: (error) WRONGTYPE Operation against a key holding the wrong kind of value
    
  • LPOP/RPOP with count against a nonexistent list returns a null array instead of (nil)(#10095). This change was backported to 6.2.

  • LPOP/RPOP used to produce (nil) when count is 0, now produces a null array (#9692). This change was backported to 6.2.

  • XCLAIM/XAUTOCLAIM skips deleted entries instead of replying with nil and deletes them from the pending entry list (#10227) - XCLAIM/XAUTOCLAIM now behaves in the following way:

    • If you try to claim a deleted entry, it is deleted from the pending entry list (PEL) where it is found (as well as the group PEL). Therefore, such an entry is not claimed, just cleared from PEL (because it doesn't exist in the stream anyway).
    • Because deleted entries are not claimed, X[AUTO]CLAIM does not return "nil" instead of an entry.
    • Added an array of all the deleted stream IDs to XAUTOCLAIM response.

ACLs

  • ACL GETUSER reply now uses ACL syntax for keys and channels (#9974). ACL GETUSER now uses the ACL DSL (Domain Specific Language) for keys and channels.

    These examples show changes in behavior:

      1: acl setuser foo off resetchannels &channel1 -@all +get
      2: OK
      3: acl getuser foo
      4: 1) "flags"
      5: 2) 1) "off"
      6: 3) "passwords"
      7: 4) (empty array)
      8: 5) "commands"
      9: 6) "-@all +get"
     10: 7) "keys"
    -11: 8) (empty array)
    +11: 8) ""
     12: 9)"channels"
    -13 10) 1) "channel1"
    +13 10) "&channel1"
    
  • SORT/SORT_RO commands reject key access patterns in GET and BY if the ACL doesn't grant the command full keyspace access (#10340) - The sort and sort_ro commands can access external keys via GET and BY. In order to make sure the user cannot violate the authorization ACL rules, Redis 7 will reject external keys access patterns unless ACL allows SORT full access to all keys. For backwards compatibility, SORT with GET/BY keeps working, but if ACL has restrictions to certain keys, the use of these features will result in a permission denied error.

    These examples show changes in behavior:

    USER FOO (+sort ~* ~mylist) 
    #FOO> sort mylist by w* get v*  - is O.K since ~* provides full key access
    
    USER FOO (+sort %R~* ~mylist) 
    #FOO> sort mylist by w* get v*  - is O.K since %R~* provides full key READ access**
    
    USER FOO (+sort %W~* ~mylist)
    #FOO> sort mylist by w* get v*  - will now fail since $W~* only provides full key WRITE access
    
    USER FOO (+sort ~v* ~mylist)
    #FOO> sort mylist by w* get v*  - will now fail since ~v* only provides partial key access
    
  • Fix ACL category for SELECT, [WAIT](/commands/wait/, ROLE [LASTSAVE](/commands/lastsave/, [READONLY](/commands/readonly/, [READWRITE](/commands/readwrite/, ASKING (#9208):

    • SELECT and WAIT have been recategorized from @keyspace to @connection
    • ROLE, LASTSAVE have been categorized as @admin and @dangerous
    • ASKING, READONLY, READWRITE have also been assigned the @connection category and removed from @keyspace
    • Command categories are explained in ACL documentation

Command introspection, stats, and configuration

  • COMMAND reply drops random and sort-for-scripts flags, which are now part of command tips (#10104) - The random flag was replaced with the nondeterministic_output tip; the sort-for-scripts flag was replaced by the nondeterministic_output_order tip

  • INFO commandstats now shows the stats per sub-command (#9504) For example, while previous versions would provide a single entry for all command usage, in Redis 7, each sub command is reported separately:

    • Redis 6.2:

      cmdstat_acl:calls=4,usec=279,usec_per_call=69.75,rejected_calls=0,failed_calls=2
      
    • Redis 7:

      cmdstat_acl|list:calls=1,usec=4994,usec_per_call=4994.00,rejected_calls=0,failed_calls=0
      cmdstat_acl|setuser:calls=2,usec=16409,usec_per_call=8204.50,rejected_calls=0,failed_calls=0
      cmdstat_acl|deluser:calls=1,usec=774,usec_per_call=774.00,rejected_calls=0,failed_calls=0
      cmdstat_acl|getuser:calls=1,usec=6044,usec_per_call=6044.00,rejected_calls=0,failed_calls=0
      
  • CONFIG REWRITE, [CONFIG RESETSTAT](/commands/config-resetstat/, and most [CONFIG SET](/commands/config-set/commands are now allowed during loading (#9878)

Deprecations

RATE THIS PAGE
Back to top ↑