github redis/go-redis v9.24.0-beta.2
9.24.0-beta.2

pre-releaseone hour ago

This is a beta release. It follows 9.24.0-beta.1 with bug fixes, the ACLGetUser command and one change to retry behavior. Read the behavior changes before you upgrade.

⚠️ Behavior changes

  • Command retries no longer replay a failed dial sequence: for clients without a custom Dialer (single commands, pipelines, Watch, Conn and Tx, the Sentinel client, Ring shards and cluster nodes), MaxRetries no longer starts a new DialerRetries sequence on an endpoint where one has already failed. With default options a refused connection is now reported after about 0.4s, where it took about 1.7s before. Attempts on other cluster nodes or Ring shards are kept, and a custom Dialer keeps its previous retry behavior. DialTimeout still applies to each attempt, so a dial that hangs is still bounded by DialTimeout times DialerRetries. A command that reaches an exhausted node or shard skips that address and keeps its bounded retries for the others, and a cluster client asks for a topology reload, so a replacement can be reached in the same call. An unpinned SCAN that exhausts a node also falls back to the replicas that ReadOnly routing allows (#4304, #4331) by @xixi-box, issue #4329.
  • Negative pool_size: ParseURL, ParseClusterURL and ParseFailoverURL reject a negative pool_size, where they used to panic, and a negative PoolSize in the options structs selects the default (#4325) by @ump45nose.
  • LimitOffset without Limit returns a page of 10: a search that sets LimitOffset and leaves Limit at 0 now returns up to 10 documents from that offset. On Redis 7 it returned an empty page before, so code that relied on the empty page now gets documents. On Redis 8 it was an error (#4285) by @kevin9327.
  • Cmd.Uint64 of a negative integer: it now returns an error, as it does for other out-of-range values, where it returned the wrapped value (for example DECR giving 18446744073709551615). Callers that read a signed 64-bit reply as unsigned, for example BITFIELD GET i64 through Uint64Slice, now get an error (#4369) by @ruziba3vich
  • FT.HYBRID COMBINE LINEAR sends WINDOW: FTHybridWithArgs sends WINDOW for LINEAR as well as for RRF. Before, a Window set together with LINEAR was silently ignored. It now takes effect (#4379) by @ruziba3vich

✨ New Features

  • ACLGetUser: returns an ACLUser with the flags, passwords, command, key and channel rules and the selectors of a user, for Redis 7.0 and later. A missing user returns redis.Nil. Cmdable gains ACLGetUser, so a custom implementation such as a mock must add it (#4357) by @ruziba3vich
  • Idle connection reaper: ConnMaxLifetimeReapInterval (on Options, ClusterOptions, FailoverOptions, RingOptions and UniversalOptions, and conn_max_lifetime_reap_interval in URLs) starts a background goroutine that closes idle connections past ConnMaxLifetime or ConnMaxIdleTime and refills the pool toward MinIdleConns, so expired connections are closed off the request path. It is off by default. When it is on, it also closes connections that were idle longer than ConnMaxIdleTime, 30 minutes by default. Connections in use, and connections that a re-auth or handoff worker owns, are skipped, and a refill toward MinIdleConns adds dials at low concurrency (#4334, #4340) by @ndyakov
  • ClusterSlotStats and ClusterSlotStatsOrderBy: CLUSTER SLOT-STATS with a slot range or ORDERBY, for Redis 8.2 and later. On a ClusterClient, MultiDBClient and AutoPipeliner the call asks every master and merges the replies, so the result covers the whole cluster and the top slots are global, as with DBSize. A pipeline still sends the command to one node. The slot metrics beyond the key count need cluster-slot-stats-enabled yes on the servers. ClusterCmdable gains the two methods, so a custom implementation such as a mock must add them (#4358) by @ruziba3vich

🐛 Bug Fixes

  • Credential rotation with MaxActiveConns: at the MaxActiveConns cap, Get now waits within PoolTimeout for an idle connection that is re-authenticating, and does not fail with ErrPoolExhausted. Without a cap, or with room under it, the behavior is unchanged (#4313) by @xixi-box, issue #4311. A race at the cap, where the only connection finished re-authentication just before the capacity check, is closed by the same release (#4333) by @Tidehyc, issue #4332
  • ContextDeadlineError: a read timeout that arrives together with data no longer reaches the next command, and a socket timeout that fires slightly before the context deadline is still reported as context.DeadlineExceeded. This follows #4263 from 9.24.0-beta.1 (#4306) by @PerryLink, issue #4305
  • Search: LimitOffset without Limit in FT.SEARCH and FT.HYBRID options now uses the default page of 10. On Redis 8 the command was rejected with SEARCH_LIMIT_OVER (#4285) by @kevin9327, issue #4284
  • GEOSEARCH without WITH flags: GeoSearchLocation no longer fails with a parse error when the query sets none of WithCoord, WithDist and WithHash. The locations come back with only Name set (#4335) by @ruziba3vich
  • BF.INFO of a non-scaling filter: BFInfo and BFInfoExpansion no longer fail with redis: nil for a filter created with NONSCALING. ExpansionRate is 0 (#4336) by @ruziba3vich
  • JSON replies to a legacy path: JSONObjLen, JSONStrLen, JSONStrAppend and JSONToggle no longer fail when the path does not start with $, and neither does JSONType with RESP2. Before, JSON.STRAPPEND and JSON.TOGGLE had already changed the document when the error was reported (#4337) by @ruziba3vich
  • JSONNumIncrBy with RESP3: a path that matches values that are not numbers no longer fails with redis: nil. Val() returns the same string as with RESP2, for example [null,7], so code that used redis.Nil to mean "no numeric match" now gets [null] (#4338) by @ruziba3vich
  • Cluster redirects to an IPv6 address with a dotted quad: a MOVED or ASK reply that points to an IPv6 address ending in a dotted quad, such as ::ffff:10.0.0.1, is now dialable. The address is bracketed like any other IPv6 address (#4350) by @ruziba3vich
  • HELLO password in traces and logs: rediscmd.CmdString now redacts the HELLO password when AUTH comes after SETNAME. Before, a HELLO sent through Do in that order showed the password in clear text in tracing and logging hooks built on rediscmd (#4348) by @ruziba3vich
  • FT.HYBRID with ShardKRatio: SHARD_K_RATIO is now counted in the KNN argument block, so the server accepts the command and no longer answers Unknown argument (#4353) by @ruziba3vich
  • FT.HYBRID COMBINE LINEAR weights: setting only Alpha or only Beta no longer fails with Missing value for BETA. Both are sent when either is set, the unset one as 0 (#4354) by @ruziba3vich
  • Empty Params map in search: FTSearchWithArgs, FTAggregateWithArgs, FTSearchQuery and FTAggregateQuery no longer send PARAMS 0 for an empty, non-nil map, which the server rejected (#4355) by @ruziba3vich
  • Ring shards that share an address: SetAddrs no longer leaks a client on each call when two shard names point to the same address. Every shard is now reused or closed (#4356) by @ruziba3vich
  • MAXTEXTFIELDS in FT.CREATE: FTCreate with MaxTextFields set now sends MAXTEXTFIELDS as a bare flag, so the server accepts it and no longer answers Unknown argument (#4344) by @ruziba3vich
  • Disabled cluster options: a -1 retry backoff set on ClusterOptions now reaches the node clients (#4345), and reusing one *ClusterOptions for a second client no longer turns disabled options (MaxRedirects, timeouts, retry backoff) back into their defaults (#4360) by @ruziba3vich
  • FT.INFO on RESP2: FTInfo reads index_definition by key, so DefaultScore and the other definition fields are correct and a short array no longer panics (#4347) by @ruziba3vich
  • JSON array commands on a legacy path: JSONArrLen, JSONArrAppend, JSONArrIndex, JSONArrInsert, JSONArrTrim and JSONArrPop no longer fail to parse when the path does not start with $, and one such reply no longer shifts the replies of the commands after it in a pipeline (#4359) by @ruziba3vich
  • JSONArrTrim arguments: the command is now sent with both start and stop, defaults 0 and -1, which keep the whole array. Before, the server rejected every call with a wrong number of arguments (#4361) by @ruziba3vich
  • net.IP fields in struct scan: HGetAll(...).Scan and HMGet(...).Scan read a net.IP that HSet stored as raw bytes, where they failed with invalid IP address. Text is tried first, so values that scanned before scan the same, and a 4 or 16 byte value that is not IP text now scans as a raw IP (#4362) by @ruziba3vich
  • Pointer arguments in command strings: Cmd.String() and rediscmd.CmdString print the value of a pointer argument to a predeclared type or time.Time, where they printed an address. The redaction of secrets such as CONFIG SET requirepass now also covers a keyword or password passed behind a pointer or as a named string (#4363) by @ruziba3vich
  • MaxRetries or MaxRedirects below -1: any negative value now means one attempt with no retries, the same as -1. Before, a value such as -2 skipped the retry loop, so a Client pipeline or transaction, a Ring command, and a ClusterClient command, pipeline or transaction were never sent and the call returned a nil error (#4349) by @ruziba3vich
  • CF.SCANDUMP last chunk: CFScanDump no longer fails with redis: nil on its last call, where the server returns iterator 0 and a null chunk (#4366) by @ruziba3vich
  • BF.INFO with an option: a single-option BF.INFO (capacity, size, items, filters, expansion) no longer fails with unexpected key, whatever case the server uses for the field name (#4368) by @ruziba3vich
  • FT.SEARCH null field on RESP2: a returned field that is a stored JSON null no longer fails the whole search with invalid field value format. RESP2 now behaves like RESP3 (#4370) by @ruziba3vich
  • FT.INFO TAG separator on RESP2: a TAG field with the separator m or M no longer swallows the next flag, so Sortable and CaseSensitive are kept (#4371) by @ruziba3vich
  • Cluster max number of clients error: shouldRetry and IsMaxClientsError also match the cluster wording max number of clients + cluster connections reached (#4367) by @ruziba3vich
  • FCall with slice arguments: FCall and FCallRO expand a []string or []interface{} argument into separate function arguments, where they failed with a marshal error. A lone nil is still sent as one empty argument (#4365) by @ruziba3vich
  • Clone of finished commands: XInfoStreamFullCmd.Clone keeps all fields, including the idempotency fields, and no longer shares the pending storage of its groups and consumers (#4372). The vector set slice commands copy their result slice instead of sharing it with the original (#4373). Empty results stay empty. FunctionStatsCmd.Clone also copies the command of the running script instead of sharing it (#4378). Clones of XMessageSliceCmd, XStreamSliceCmd, XInfoStreamCmd, ClientInfoCmd, ACLLogCmd and FTSearchCmd keep every field of the value, such as the XREADGROUP claim fields, the idempotency fields, the ClientInfo network and command totals and Document.Error, where they dropped them before (#4346). By @ruziba3vich
  • Slice arguments in Bloom, Cuckoo and Count-Min commands: BFInsert, BFMAdd, BFMExists, CFInsert, CFInsertNX, CFMExists and CMSQuery expand a single []string or []interface{} of elements, where they failed with a marshal error. Other arguments, including []byte and nil, are sent as before (#4377) by @ruziba3vich

🧪 Testing & Infrastructure

  • Documentation: doc link definitions in the set and search command comments now render as links on pkg.go.dev (#4328) by @farisbasha
  • End-to-end failure scenarios: the e2e suites cover connection failures (dropped, refused, timed out) for regular, pub/sub, blocking and mixed workloads, MultiDBClient failover on member outage and on slow responses, and standalone topology changes. The fault-injector client gains proxy_failure, BDB-scoped network_latency and the /topology-change-standalone routes (#4352)

👥 Contributors

We'd like to thank all the contributors who worked on this release!

@farisbasha, @kevin9327, @PerryLink, @ruziba3vich, @Tidehyc, @ump45nose, @xixi-box


Full Changelog: v9.24.0-beta.1...v9.24.0-beta.2

Don't miss a new go-redis release

NewReleases is sending notifications on new releases.