天天看點

Redis6.2版本特性介紹Introduction to the Redis 6.2 release

Introduction to the Redis 6.2 release

This release is the first significant Redis release managed by the core team

under the new project governance model.

Redis 6.2 includes many new commands and improvements, but no big features. It

mainly makes Redis more complete and addresses issues that have been requested

by many users frequently or for a long time.

Redis 6.2包含很多新指令和提升,但是沒有大的特性功能。主要是讓Redis更完整,并且解決使用者常提到的和已經存在很長時間的問題。

Many of these changes were not eligible for 6.0.x for several reasons:

很多改動不适合6.0.x版本,因為:
  1. They are not backward compatible, which is always the case with new or

    extended commands (that cannot be replicated to an older replica).

    因為新的指令或者擴充的指令是不可回退的(不可複制到舊的副本上)。
  2. They require a longer release-candidate test cycle.
    因為它們需要一個更長釋出測試的周期。

Here is a comprehensive list of changes in this release compared to 6.0.9,

each one includes the PR number that added it, so you can get more details

at https://github.com/redis/redis/pull/

以下是全部更新清單

New commands / args:

  • Add SMISMEMBER command that checks multiple members (#7615)
  • Add ZMSCORE command that returns an array of scores (#7593)
  • Add LMOVE and BLMOVE commands that pop and push arbitrarily (#6929)
  • Add RESET command that resets client connection state (#7982)
  • Add COPY command that copies keys (#7953)
  • Add ZDIFF and ZDIFFSTORE commands (#7961)
  • Add ZINTER and ZUNION commands (#7794)
  • Add GEOSEARCH/GEOSEARCHSTORE commands for bounding box spatial queries (#8094)
  • Add GET parameter to SET command, for more powerful GETSET (#7852)
  • Add exclusive range query to XPENDING (#8130)
  • Add exclusive range query to X[REV]RANGE (#8072)
  • Add GT and LT options to ZADD for conditional score updates (#7818)
  • Add CLIENT INFO and CLIENT LIST for specific ids (#8113)
  • Add IDLE argument to XPENDING command (#7972)
  • Add local address to CLIENT LIST, and a CLIENT KILL filter. (#7913)
  • Add NOMKSTREAM option to XADD command (#7910)
  • Add command introspection to Sentinel (#7940)
  • Add SENTINEL MYID subcommand (#7858)
新指令 / 參數:
  • 新增SMISMEMBER指令批量檢查成員。
  • 新增ZMSCORE指令傳回分數數組
  • 新增 LMOVE 和 BLMOVE指令來任意存取元素
  • 新增 RESET 指令重置用戶端連接配接狀态
  • 新增 COPY 指令複制鍵
  • 新增 ZDIFF 和 ZDIFFSTORE 指令
  • 新增 ZINTER 和 ZUNION 指令
  • 新增 GEOSEARCH/GEOSEARCHSTORE 指令用于綁定矩形查詢
  • 新增 GET 指令的參數到 SET 指令,以實作更強大的 GETSET
  • 新增 XPENDING 指令的獨占範圍查詢
  • 新增 X[REV]RANGE 指令的獨占範圍查詢
  • 新增 ZADD 指令的 GT 和 LT 選項以實作條件分數更新
  • 新增 CLIENT INFO 和 CLIENT LIST 指令用于指定 id
  • 新增 IDLE 參數到 XPENDING 指令
  • 新增本地位址到 CLIENT LIST,并且添加 CLIENT KILL 篩選器
  • 新增 NOMKSTREAM 參數到 XADD 指令
  • 新增introduction指令到Sentinel執行個體
  • 新增 SENTINEL MYID 子指令

New features:

  • Dump payload sanitization: prevent corrupt payload causing crashes (#7807)

    Has flags to enable full O(N) validation (disabled by default).

  • ACL patterns for Pub/Sub channels (#7993)
  • Support ACL for Sentinel mode (#7888)
  • Support getting configuration from both stdin and file at the same time (#7893)

    Lets you avoid storing secrets on the disk.

新特性:
  • 導出和載入資料的安全性: 防止損壞資料導緻崩潰。

    有标記來開啟 全量 O(N)校驗(預設是關閉的)

  • Pub/Sub頻道支援 ACL規則
  • Sentinel模式支援 ACL
  • 同時支援從标準輸入流和配置檔案擷取配置,可以避免密鑰存儲到磁盤上。

New features in CLI tools:

  • redis-cli RESP3 push support (#7609)
  • redis-cli cluster import support source and target that require auth (#7994)
  • redis-cli URIs able to provide user name in addition to password (#8048)
  • redis-cli/redis-benchmark allow specifying the prefered ciphers/ciphersuites (#8005)
  • redis-cli add -e option to exit with code when command execution fails (#8136)
用戶端工具新特性:
  • redis-cli RESP3協定推送支援
  • redis-cli cluster叢集導入支援源和目标支援密碼
  • redis-cli URIs 除密碼外還可以提供使用者名
  • redis-cli/redis-benchmark支援指定首選密碼
  • redis-cli 增加 -e選項來在指令執行失敗退出時傳回的代碼

Command behavior changes:

  • EXISTS should not alter LRU (#8016)

    In Redis 5.0 and 6.0 it would have touched the LRU/LFU of the key.

  • OBJECT should not reveal logically expired keys (#8016)

    Will now behave the same TYPE or any other non-DEBUG command.

  • Improve db id range check for SELECT and MOVE (#8085)

    Changes the error message text on a wrong db index.

  • Modify AUTH / HELLO error message (#7648)

    Changes the error message text when the user isn’t found or is disabled.

  • BITOPS length limited to proto_max_bulk_len rather than 512MB (#8096)

    The limit is now configurable like in SETRANGE, and APPEND.

  • GEORADIUS[BYMEMBER] can fail with -OOM if Redis is over the memory limit (#8107)
指令行行為改變:
  • EXISTS不會改變LRU(#8016)

    在Redis 5.0和6.0中,它會改變LRU/LFU的鍵。

  • OBJECT不會暴露邏輯過期的鍵(#8016)

    TYPE或任何其他非DEBUG指令也一樣。

  • 提升 SELECT 和MOVE指令的資料庫id的檢查範圍

    調整了資料庫索引錯誤傳回的錯誤資訊

  • 調整 AUTH / HELLO 的錯誤資訊

    修改了使用者不存在或使用者被禁用後的錯誤資訊提示

  • BITOPS 長度限制為proto_max_bulk_len而不是512MB(#8096)

    長度限制現在是可配置的,和SETRANGE、APPEND的一樣。

  • GEORADIUS[BYMEMBER] 可以帶-OOM參數失敗,如果Redis出現記憶體超限的情況。

Other behavior changes:

  • Optionally (default) fail to start if requested bind address is not available (#7936)

    If you rely on Redis starting successfully even if one of the bind addresses

    is not available, you’ll need to tune the new config.

  • Limit the main db dictionaries expansion to prevent key eviction (#7954)

    In the past big dictionary rehashing could result in massive data eviction.

    Now this rehashing is delayed (up to a limit), which can result in performance

    loss due to hash collisions.

  • CONFIG REWRITE is atomic and safer, but requires write access to the config file’s folder (#7824, #8051)

    This change was already present in 6.0.9, but was missing from the release

    notes.

  • A new incremental eviction mechanism that reduces latency on eviction spikes (#7653)

    In pathological cases this can cause memory to grow uncontrolled and may require

    specific tuning.

  • Not resetting “save” config when Redis is started with command line arguments. (#7092)

    In case you provide command line arguments without “save” and count on it

    being disabled, Now the defaults “save” config will kick in.

  • Update memory metrics for INFO during loading (#7690)
  • When “supervised” config is enabled, it takes precedence over “daemonize”. (#8036)
  • Assertion and panic, print crash log without generating SIGSEGV (#7585)
  • Added crash log report on SIGABRT, instead of silently exiting (#8004)
  • Disable THP (Transparent Huge Pages) if enabled (#7381)

    If you deliberately enabled it, you’ll need to config Redis to keep it.

其他行為變更:
  • 選擇性地(預設)失敗啟動,如果請求的綁定位址不可用(#7936)

    如果您依賴Redis啟動成功,即使一個綁定位址不可用,您需要調整新的配置。

  • 限制主db字典擴充以防止鍵退出(#7954)

    在過去的時候,大字典重哈希可能導緻大量資料退出。

    現在,這個rehash的延遲(最多到一個限制),可能導緻性能下降,因為哈希沖突。

  • CONFIG REWRITE是原子的和安全的,但是需要寫入配置檔案的檔案夾(#7824,#8051)

    這個功能在6.0.9已經上線了,但是在版本說明中沒有展現。

  • 增加一個增量eviction機制,減少eviction峰值的延遲(#7653)

    在某些場景這可能會導緻記憶體增長不受控制,可能需要特定的調整。

  • 當Redis使用指令行參數啟動時,不重置“save”配置(#7092)

    在您使用指令行參數時,如果未“save”的配置,現在預設的“save”配置将被啟用。

  • 在執行個體Loading時會更新INFO指令的記憶體名額(#7690)
  • 當“supervised”配置啟用時,它優先于“daemonize”。(#8036)
  • 斷言和panic,列印crash日志而不生成SIGSEGV(#7585)
  • 在SIGABRT時增加崩潰日志報告,而不是靜默退出。
  • 禁用 THP (大頁配置)如果啟用了。

    如果您手動設定啟用了大頁配置,則需要修改Redis配置來保持。

Bug fixes:

  • Handle output buffer limits for module blocked clients (#8141)

    Could result in a module sending reply to a blocked client to go beyond the

    limit.

  • Fix setproctitle related crashes. (#8150, #8088)

    Caused various crashes on startup, mainly on Apple M1 chips or under

    instrumentation.

  • A module doing RM_Call could cause replicas to get nested MULTI (#8097).
  • Backup/restore cluster mode keys to slots map for repl-diskless-load=swapdb (#8108)

    In cluster mode with repl-diskless-load, when loading failed, slot map

    wouldn’t have been restored.

  • Fix oom-score-adj-values range, and bug when used in config file (#8046)

    Enabling setting this in the config file in a line after enabling it, would

    have been buggy.

  • Reset average ttl when empty databases (#8106)

    Just causing misleading metric in INFO

  • Disable rehash when Redis has child process (#8007)

    This could have caused excessive CoW during BGSAVE, replication or AOFRW.

  • Further improved ACL algorithm for picking categories (#7966)

    Output of ACL GETUSER is now more similar to the one provided by ACL SETUSER.

  • Fix bug with module GIL being released prematurely (#8061)

    Could in theory (and rarely) cause multi-threaded modules to corrupt memory.

  • Fix cluster redirect for module command with no firstkey. (#7539)
  • Reduce effect of client tracking causing feedback loop in key eviction (#8100)
  • Kill disk-based fork child when all replicas drop and ‘save’ is not enabled (#7819)
  • Rewritten commands (modified for propagation) are logged as their original command (#8006)
  • Fix cluster access to unaligned memory (SIGBUS on old ARM) #7958
  • If diskless repl child is killed, make sure to reap the child pid (#7742)
  • Broadcast a PONG message when slot’s migration is over, may reduce MOVED responses (#7571)
問題修複:
  • 處理輸出緩沖區限制的子產品阻塞用戶端(#8141)

    可能導緻子產品向阻塞用戶端發送回複超過限制。

  • 修複setproctitle(設定程序名稱python操作)相關的崩潰。(#8150,#8088)

    啟動時各種崩潰,主要是在Apple M1晶片或平台。

  • 一個子產品執行RM_Call操作時可能導緻副本執行個體嵌套MULTI(#8097)
  • 在repl-diskless-load=swapdb時,将備份/還原叢集模式的鍵到槽的映射#8108)

    在叢集模式下使用無盤加載時repl-diskless-load,當加載失敗時,槽映射不會被恢複。

  • 修複oom-score-adj-values範圍,以及在配置檔案中使用時出現的bug(#8046)

    在配置檔案中設定這個配置以後啟用會出現問題。

  • 當清空的資料庫時重置平均ttl(#8106)

    會導緻在INFO指令中出現不可預料的名額

  • 禁用rehash,當Redis有子程序時(#8007)

    這可能導緻在BGSAVE,主從複制或AOFRW時出現過度CoW(Copy on Write)

  • 進一步改進了用于選擇類别的ACL算法

    現在,ACL Getuser的輸出與ACL Setuser提供的輸出更相似。

  • 修複GIL子產品過早釋放的問題

    理論上(極少)會導緻多線程子產品損壞記憶體的問題。

  • 修複了無FirstKey的子產品指令的叢集重定向(#7539)
  • 降低在key移除時對用戶端的回報環節的影響。
  • 當所有的副本丢棄并且“save”沒有啟用時,磁盤基礎的fork子程序将被殺死(#7819)
  • 重寫的指令被記錄為它的原始指令(#8006)
  • 修複叢集通路不對齊記憶體問題(舊的ARM架構為SIGBUS)(#7958)
  • 如果無磁盤複制的子程序被殺死,確定能擷取到子程序的id(#7742)
  • 當slot的遷移完成時,廣播一個PONG消息,可以減少MOVED傳回(#7571)

Other improvements:

  • TLS Support in redis-benchmark (#7959)
  • Accelerate diskless master connections, and general re-connections (#6271)
  • Run active defrag while blocked / loading (#7726)
  • Performance and memory reporting improvement - sds take control of its internal fragmentation (#7875)
  • Speedup cluster failover. (#7948)
其他改進
  • 在redis-benchmark支援TLS(#7959)
  • 加速無磁盤複制主連接配接,并且一般的重新連接配接(#6271)
  • 在阻塞或加載資料時運作主動碎片整理
  • 性能和記憶體使用情況的改進 - sds控制其内部分裂(#7875)

Platform / toolchain support related improvements:

  • Optionally (not by default) use H/W Monotonic clock for faster time sampling (#7644)
  • Remove the requirements for C11 and _Atomic supporting compiler (#7707)

    This would allow to more easily build and use Redis on older systems and compilers again.

  • Fix crash log registers output on ARM. (#8020)
  • Raspberry build fix. (#8095)
  • Setting process title support for Haiku. (#8060)
  • DragonFlyBSD RSS memory sampling support. (#8023)
平台/工具鍊支援相關改進
  • 可選的(非預設配置)使用H/W Monotonic時間采樣(#7644)
  • 删除編譯器對C11和_Atomic支援的的需求(#7707)

    這樣可以更容易在舊系統和編譯器上建構和使用Redis。

  • 修複ARM的崩潰日志輸出。(#8020)
  • 樹莓派系統編譯修複。(#8095)
  • 設定程序标題支援Haiku(作業系統)。(#8060)
  • DragonFlyBSD RSS記憶體采樣支援。(#8023)

New configuration options:

  • Enable configuring OpenSSL using the standard openssl.cnf (#8143)
  • oom-score-adj-values config can now take absolute values (besides relative ones) (#8046)
  • TLS: Add different client cert support. (#8076)
  • Note that a few other changes listed above added their config options.
新配置選項:
  • 支援配置OpenSSL使用标準openssl.cnf(#8143)
  • oom-score-adj-values配置可以現在接受絕對值(除了相對值)(#8046)
  • TLS:添加不同的用戶端證書支援。(#8076)
  • 上面列出的其他一些更改添加了其配置選項。

Info fields and introspection changes:

  • Add INFO fields to track diskless and disk-based replication progress (#7981)
  • Add INFO field for main thread cpu time, and scrape system time. (#8132)
  • Add total_forks to INFO STATS (#8155)
  • Add maxclients and cluster_connections to INFO CLIENTS (#7979)
  • Add tracking bcast flag and client redirection in client list (#7995)
  • Fixed INFO client_recent_max_input_buffer includes argv array (#8065, see #7874)
  • Note that a few other changes listed above added their info fields.
info字段和介紹改進:
  • 添加INFO字段跟蹤磁盤無磁盤複制和磁盤複制進度(#7981)
  • 添加INFO字段主線程CPU時間,并采集系統時間。(#8132)
  • 添加total_forks字段到INFO STATS(#8155)
  • 添加maxclients和cluster_connections字段到INFO CLIENTS(#7979)
  • 添加跟蹤bcast(廣播位址)标志和用戶端重定向資訊到 client list(#7995)
  • 修複INFO client_recent_max_input_buffer包含argv數組的問題(#8065,參見#7874)
  • 上面列出的其他一些更改添加了其info字段。

Module API changes:

  • Add CTX_FLAGS_DENY_BLOCKING as a unified the way to know if blocking is allowed (#8025)
  • Add data type callbacks for lazy free effort, and unlink (#7912)
  • Add data type callback for COPY command (#8112)
  • Add callbacks for defrag support. (#8149)
  • Add module event for repl-diskless-load swapdb (#8153)
子產品API改進:
  • 添加CTX_FLAGS_DENY_BLOCKING作為一個統一的方式來知道是否允許阻塞(#8025)
  • 惰性删除和unlink增加傳回資料類型(#7912)
  • COPY指令增加資料類型傳回(#8112)
  • 碎片整理增加資料類型傳回(#8149)
  • 增加repl-diskless-load swapdb子產品事件(#8153)

Module related fixes:

  • Moved RMAPI_FUNC_SUPPORTED so that it’s usable (#8037)
  • Improve timer accuracy (#7987)
  • Allow ‘\0’ inside of result of RM_CreateStringPrintf (#6260)
子產品相關修複:
  • 移動RMAPI_FUNC_SUPPORTED,使其可用(#8037)
  • 提高定時器精度(#7987)
  • 允許“\0”在出現RM_CreateStringPrintf的結果中(#6260)

Redis 6.2 is mostly a strict superset of 6.0, you should not have any problem

upgrading your application from 6.0 to 6.2. However there are some small changes

of behavior listed above, please make sure you are not badly affected by any of

them.

Specifically these sections:

  • Command behavior changes
  • Other behavior changes