Skip to content

v0.8.9 — a command must not write what it cannot propagate

Latest

Choose a tag to compare

@TinDang97 TinDang97 released this 04 Sep 10:52
· 885 commits to main since this release
6251429

Patch release rolling up 2 merged PRs closing 3 issues since v0.8.8.

One invariant: a command must not write what it cannot propagate.

Propagation is gated on the reply not being an error (!matches!(resp, Frame::Error(_))), so any command that mutates and then returns an error leaves a write applied on the master, never appended to the AOF and never sent to a replica — silent data loss across restart, permanent replica divergence.

Correctness

Lua arguments are refused at the boundary (#823, PR #824). redis.call/redis.pcall converted a Lua nil, boolean or table argument into a frame shape no wire client can produce, which HSET, HMSET, LPUSH, RPUSH, LPUSHX, RPUSHX, ZREM, MSET and MSETNX each discovered from inside their mutation loop:

EVAL "return redis.pcall('LPUSH','mylist','a','b',true)" 0
  -> ERR wrong number of arguments for 'lpush' command
LLEN mylist = 2          <- the error was a lie; two elements are resident
[restart]
LLEN mylist = 0          <- gone

Fixed at the boundary, as Redis 8.6.1 refuses it, and by hoisting validation above the mutation window in all nine commands — defence in depth, because the raw wire reaches the same code with no Lua anywhere.

XADD stops creating a stream it then rejects (#823, PR #824). It called get_or_create_stream before parsing the ID, so all five of bogus, 0-0, 1-1-1, abc-1 and -5 created a charged, DBSIZE-visible stream that was never logged and vanished on restart. 3,000 rejected XADDs cost 1.46 MB that nothing credits back.

Blocking pops propagate (#827, PR #828). BLPOP, BRPOP, BLMOVE, BRPOPLPUSH, BZPOPMIN, BZPOPMAX, BLMPOP and BZMPOP mutated, acked the client, and fed neither plane — sixteen cases across all eight commands on both the immediately-satisfiable and the parked-then-woken path, sixteen losses. For a queue consumer on BLPOP this redelivered every message already consumed after a master restart or on failover.

The blocking path is an intercept: it short-circuits the dispatch exit where every other write meets the AOF and the replication stream. That is the same structural gap moon#644 closed for tracking invalidation on the same path in v0.8.7. The new record is the synthesised non-blocking sibling — a replica applying a literal BLPOP would park its apply loop — derived from the reply, since a blocking pop takes many keys and only the reply says which one served. For BLMPOP/BZMPOP it carries the count actually popped, never the requested one.

Known divergence riding this release

moon#825 — SPOP and XADD * propagate their literal bytes, so a replica or AOF replay produces a different result. Deferred to v0.8.10; both blocked fix seams are documented on the issue.

Validation

GCE Linux gate green on every release head, all four legs each — monoio with io_uring live (640s), tokio (621s), client-compat against a real redis-server (239s), MSRV 1.94. Hosted dispatch matrix green (Check Windows, MSRV, Memory steady-state).

The #827 fix was mutation-tested: disabling only the sharded wiring turns all sixteen cases red again, proving both runtime sites are genuinely exercised rather than one covering for the other. Over-propagation was checked against the AOF bytes — timeouts, WRONGTYPE and misses reach neither plane; BLMPOP … COUNT 10 that popped 3 logs LPOP mp 3; multi-key BLPOP first second served by second logs LPOP second — and moon#539's phantom-key guard is unaffected.

Two CI failures during the cut were A/B'd to load-sensitivity and not to these changes, with evidence filed on moon#738.

Also

Corrects two artefacts of v0.8.8's cut, which was squashed into #785: the README version table had no v0.8.8 row and still marked v0.8.7 current, and the CHANGELOG carried a duplicate truncated #788 bullet.

Full changelog: v0.8.8...v0.8.9