Skip to content

Latest commit

 

History

History
764 lines (680 loc) · 54.7 KB

COMPATIBILITY.md

File metadata and controls

764 lines (680 loc) · 54.7 KB

ReRu compatibility status

Updated: 17 November 2026. This inventory describes the implementation and local tests; it does not certify complete compatibility with Redis.

Implemented commands

Area Commands Current scope
Connection PING, ECHO, HELLO, SELECT, RESET, CLIENT ID, CLIENT SETNAME, CLIENT GETNAME, CLIENT SETINFO, CLIENT INFO, CLIENT REPLY RESP2 handshake, optional inline authentication/name, database 0 selection, socket metadata, reply suppression and context reset
Strings/cache SET, GET, INCR, GETEX, GETDEL, MGET, MSET, MSETNX, APPEND, STRLEN, SETNX, SETEX, PSETEX, GETSET, INCRBY, INCRBYFLOAT, DECR, DECRBY, GETRANGE, SUBSTR, SETRANGE, LCS Binary values; SET NX/XX/GET/EX/PX/EXAT/PXAT/KEEPTTL; GETEX expiry/PERSIST; multi-key access, numeric arithmetic and byte ranges; longest common subsequence with LEN/IDX/MINMATCHLEN/WITHMATCHLEN
Lists RPUSH, LPUSH, LPUSHX, RPUSHX, LRANGE, LLEN, LINDEX, LSET, LINSERT, LTRIM, LREM, LPOS, LPOP, RPOP, RPOPLPUSH, LMOVE, BLPOP, BRPOP, BLMOVE, BRPOPLPUSH, LMPOP, BLMPOP Multiple elements, negative indexes, edits, moves, position search, single/multi-key blocking pops and moves with timeout
Streams XADD, XRANGE, XREVRANGE, XREAD, XLEN, XDEL, XTRIM, XGROUP CREATE, XGROUP SETID, XGROUP DESTROY, XGROUP CREATECONSUMER, XGROUP DELCONSUMER, XREADGROUP, XACK, XPENDING, XCLAIM, XAUTOCLAIM, XINFO GROUPS, XINFO CONSUMERS, XINFO STREAM, XSETID IDs, ranges, deletion, exact trimming, blocking reads, consumer groups, pending entries, acknowledgement, claiming and diagnostics; XADD NOMKSTREAM/MAXLEN/MINID. XRANGE with COUNT 0 or a negative count returns a null array for an existing stream and an empty array for a missing key; XREAD/XREADGROUP treat COUNT 0 or a negative count as unlimited
Hashes HSET, HMSET, HSETNX, HGET, HMGET, HGETALL, HDEL, HEXISTS, HLEN, HKEYS, HVALS, HINCRBY, HINCRBYFLOAT, HSTRLEN, HRANDFIELD, HSCAN, HEXPIRE, HPEXPIRE, HEXPIREAT, HPEXPIREAT, HTTL, HPTTL, HEXPIRETIME, HPEXPIRETIME, HPERSIST, HGETEX, HSETEX Binary fields/values, multiple field updates, missing-field nil replies, increments, cursor iteration, per-field expiry and conditional TTL changes; HSETEX/HGETEX/HEXPIRE accept options before or after FIELDS, field deadlines use Redis's 46-bit millisecond cap, HTTL rounds up, and HEXPIRETIME rounds the absolute second up
Sets SADD, SREM, SISMEMBER, SMISMEMBER, SMEMBERS, SCARD, SMOVE, SPOP, SRANDMEMBER, SUNION, SINTER, SINTERCARD, SDIFF, SUNIONSTORE, SINTERSTORE, SDIFFSTORE, SSCAN Binary members, deduplication, membership, cardinality, random selection, atomic moves, set algebra and cursor iteration; SINTERCARD LIMIT
Sorted sets ZADD, ZINCRBY, ZCARD, ZSCORE, ZRANK, ZREVRANK, ZRANGE, ZREVRANGE, ZRANGESTORE, ZRANGEBYSCORE, ZREVRANGEBYSCORE, ZRANGEBYLEX, ZREVRANGEBYLEX, ZCOUNT, ZLEXCOUNT, ZREM, ZREMRANGEBYSCORE, ZREMRANGEBYRANK, ZREMRANGEBYLEX, ZMSCORE, ZSCAN, ZPOPMIN, ZPOPMAX, ZMPOP, BZMPOP, BZPOPMIN, BZPOPMAX, ZUNION, ZUNIONSTORE, ZINTER, ZINTERSTORE, ZDIFF, ZDIFFSTORE, ZINTERCARD Score-ordered members, rank, score and lex ranges, ZADD NX/XX/GT/LT/CH/INCR, cursor iteration, range removal, ordered and multi-key blocking pops, weighted algebra and destination storing
Vector sets VADD, VCARD, VDIM, VEMB, VREM, VSIM Bounded VALUES/FP32 inserts, Q8 or NOQUANT storage, binary members, exact VSIM ... TRUTH with COUNT and WITHSCORES
Bitmaps SETBIT, GETBIT, BITCOUNT, BITOP, BITPOS, BITFIELD, BITFIELD_RO Bitmaps stored as strings, byte/bit count ranges, AND/OR/XOR/NOT; bitfield GET/SET/INCRBY, signed/unsigned widths, # offsets and WRAP/SAT/FAIL overflow modes
HyperLogLog PFADD, PFCOUNT, PFMERGE Approximate distinct counts, multi-key unions, binary members, Redis dense/sparse interchange, cached cardinality
Geospatial GEOADD, GEOPOS, GEOHASH, GEODIST, GEOSEARCH, GEOSEARCHSTORE Geo points use sorted-set scores; NX/XX/CH, positions and distances, radius/box search, sort/count, decorated results, and destination storing
Keyspace TYPE, DEL, UNLINK, EXISTS, TOUCH, DBSIZE, KEYS, SCAN, RANDOMKEY, COPY, RENAME, RENAMENX, TTL, PTTL, EXPIRE, PEXPIRE, EXPIREAT, PEXPIREAT, EXPIRETIME, PEXPIRETIME, PERSIST, OBJECT ENCODING, OBJECT REFCOUNT, FLUSHDB, FLUSHALL Multiple keys, glob and type filtered scanning, rename/copy with TTL, relative/absolute expiry conditions with EXPIRETIME rounding half up and PEXPIRETIME exact for absolute deadlines, advisory encoding labels with Redis 8 thresholds, constant reference counts, whole-database flush
Transactions MULTI, EXEC, DISCARD, WATCH, UNWATCH Queuing, atomic execution relative to other commands, runtime errors, optimistic locking
Pub/Sub PUBLISH, SUBSCRIBE, UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, PUBSUB Binary channels/messages, glob patterns, RESP2 subscribed mode, CHANNELS/NUMSUB/NUMPAT; local process only. Each subscriber has its own output buffer and writer thread; frames are queued whole, a publish never waits for a slow reader or skips a live listener, and a subscriber is dropped only above 32 MiB of buffered output or after staying above 8 MiB for 60 seconds. UNSUBSCRIBE/PUNSUBSCRIBE without names replies in sorted order where Redis uses hash order
Connection close QUIT Ignores extra arguments, replies OK, and closes the connection
Authentication AUTH, ACL WHOAMI Startup-configured password for the default user, connection-local authentication and authenticated ReRu replication
Configuration CONFIG GET, CONFIG SET, CONFIG RESETSTAT Runtime maxmemory, maxmemory-policy, maxclients, and latency-monitor-threshold; GET also reports AOF enabled/fsync mode and configured RDB dir/dbfilename; RESETSTAT clears counters exposed by INFO
Observability INFO, LATENCY LATEST, LATENCY HISTORY, LATENCY RESET Partial memory, stats, clients, and persistence INFO sections, which accept multiple sections and the all, everything, and default aliases; only the command latency event is implemented, blocking commands are excluded so wait time is not counted, same-second spikes merge by maximum, up to 160 recent samples are retained, and LATENCY commands are not monitored. Commands queued in MULTI are not timed individually; EXEC is measured as one command
Server time TIME Epoch seconds and microseconds as RESP2 bulk strings
Persistence SAVE, BGSAVE, LASTSAVE, DUMP, RESTORE, BGREWRITEAOF Initial Redis RDB interoperability; supported values, key expiry, checksums, REPLACE/ABSTTL; manual single-file AOF compaction
Command introspection COMMAND, COMMAND COUNT, COMMAND INFO Lists ReRu's implemented command metadata, counts entries, or looks up names
Two-node Cluster CLUSTER KEYSLOT, CLUSTER SHARDS, CLUSTER SLOTS, CLUSTER SETSLOT, ASKING, MIGRATE Manual slot migration and binary-safe ReRu-to-ReRu key transfer, ASK/MOVED/TRYAGAIN, persistent ownership with --cluster-state; no gossip or failover

COMMAND entries use the ten-field Redis 8 reply shape: name, arity, flags, first/last/step key positions, ACL categories, tips, key specifications, and subcommands. ReRu does not track command flags, ACL categories, tips, or key specifications, so those fields are empty arrays. Commands with dynamic key positions (including XREAD, LMPOP, and ZINTERCARD) report zero legacy key positions; clients cannot use this reply to discover their keys yet. Subcommands are nested under their parent command. COMMAND INFO with no names returns all entries; named lookups preserve order and return nil for unknown names. COMMAND and COMMAND INFO return the same top-level entries, and COMMAND COUNT counts those entries. Redis documents COMMAND, COMMAND COUNT, and COMMAND INFO.

Total: 237 Redis command metadata entries, or 51.6% name presence against 459 entries in the pinned Redis 8.10.2 metadata. This is neither a behavior pass rate nor a percentage of Redis completed. Run powershell -File scripts/command_coverage.ps1 -RedisSource PATH_TO_REDIS_8_10_2 from the repository root to reproduce the count. Many options and error cases within those entries remain unsupported.

LMPOP and BLMPOP choose the first nonempty key in argument order and return the popped members in left or right pop order. BLMOVE and BRPOPLPUSH move one element atomically and block on a missing source. Timeout 0 waits indefinitely outside transactions; inside MULTI/EXEC these commands return immediately. Waiting clients do not yet have Redis's FIFO ordering guarantee. ZMPOP, BZMPOP, BZPOPMIN, and BZPOPMAX similarly choose the first nonempty sorted-set key, pop in score order, and delete an emptied key. Blocking forms wait for another write and return immediately inside MULTI/EXEC. A type change on a watched key does not wake a blocked list or XREAD client; only a value of the expected type does. Once data is available, the scan still reports WRONGTYPE when an earlier key in the list has another type, and XREAD reports it when any stream has another type. An existing wrong type errors on the first call.

Geo search scans the sorted set, then filters and sorts candidates. This is slower than Redis's geohash-area query for large datasets. Coordinates are printed with Redis's shortest round-trip digits and its small-value exponent rule; a small fraction of values keep 16 digits where Redis prints 17. GEO readers truncate fractional destination scores, so STOREDIST results stay readable. Scores below 0 or at least 2^52 return nil where Redis decodes them. COUNT ANY currently uses the same post-filter limit as COUNT; Redis may stop early. The GEORADIUS aliases and cross-dateline box behavior remain to be verified.

WATCH tracks writes even if the resulting value is unchanged, missing-key creation/deletion, and natural expiry. EXEC and DISCARD clear the connection's watches; UNWATCH clears them outside MULTI. Inside MULTI, UNWATCH is queued. Queue-time validation follows each command's declared arity. PING, INFO, FLUSHDB, FLUSHALL, COPY, LPOP, HSET, SPOP, and ZRANK queue when they meet their declared minimum arity; invalid option shapes or excess arguments then surface as individual errors in the EXEC reply. Fixed-arity commands still abort the transaction at queue time. Subcommand-specific validation remains for connection, configuration, latency, cluster, XGROUP, XINFO, and ACL. Disconnects release registrations. Replica updates identify changed keys; unrelated writes preserve watches, while a full resync invalidates all watches.

Hashes and sets preserve key expiry when updated and disappear after the last field/member is removed. No-op HSETNX, HDEL, SADD and SREM preserve watches; HSET/HMSET writes invalidate watches even when values are unchanged. Hash/set enumeration is sorted in ReRu for stable output; clients should treat ordering as unspecified. HMSET is supported for older clients; prefer HSET for new code. Hash fields can also expire independently. The four H*EXPIRE variants accept NX/XX/GT/LT and report a status for each field; HTTL/HPTTL and the absolute-time queries report -2 for missing fields and -1 for persistent fields. HGETEX and HSETEX support their Redis 8 expiry, persistence, and conditional options. A field's TTL is cleared by HSET/HMSET/HDEL and preserved by HINCRBY/HINCRBYFLOAT. Expired fields disappear on reads and through the background expiry worker, which indexes each hash by its next field deadline. Field deadlines survive ReRu snapshots, AOF replay and rewrite, and ReRu-to-ReRu replication. Redis RDB SAVE/BGSAVE and DUMP reject hashes with live field TTLs rather than silently dropping them; Redis RDB hash-field expiry encoding and RESTORE interoperability remain pending. Commands and error replies are covered by local integration tests and a Redis 8.10.2 differential test. SINTERCARD supports multiple keys and LIMIT. SPOP and SRANDMEMBER use a randomized member order; a count above the set size returns the whole set, while repeating negative counts are capped at one million elements to bound allocation. Set store variants replace the destination and clear its previous TTL. HRANDFIELD follows the same clamping and cap rules, and HRANDFIELD ... WITHVALUES rejects counts outside ±i64::MAX/2 because each field costs two reply elements. HINCRBYFLOAT uses Rust f64 arithmetic, so last-digit results can differ from Redis long-double arithmetic. INCRBYFLOAT has the same precision limitation. Both reject nonfinite input and overflow without changing the stored value. HSCAN, SSCAN, and ZSCAN currently use sorted offset cursors, rebuilding their index for each call. They apply MATCH after page selection and accept COUNT as a page size; concurrent edits may repeat or skip elements. HSCAN supports NOVALUES. SETRANGE currently caps growth at 64 MiB. Expiry arguments must be canonical integers: non-canonical or out-of-range integers return value is not an integer or out of range, while zero, negative, or second-to-millisecond overflow returns invalid expire time. Relative expiries near i64 milliseconds keep the key in ReRu where Redis's own arithmetic overflows and drops it. SET allows repeated NX/XX/GET/KEEPTTL flags and last-wins repeated expiry options with the same unit; GETEX does the same for PERSIST and checks option syntax, then the key and type, then the expiry value, matching Redis's nil/WRONGTYPE precedence. Mixing expiry units, or combining an expiry with KEEPTTL/PERSIST, is a syntax error.

LCS returns the longest common subsequence of two string values. LEN reports only the length and uses two rows of the dynamic-programming table; the other forms keep the full table. Every form first checks the table size and rejects more than 8,000,000 cells with ERR LCS keys are too large; that is about 32 MB of table, or two equal keys of up to 2,828 bytes, because the product (len1 + 1) * (len2 + 1) must not exceed 8,000,000. Redis bounds transient memory with proto-max-bulk-len (512 MiB by default), which is a looser limit than ReRu's cell cap. The command holds the dataset lock while it computes. Missing keys are treated as empty strings, MINMATCHLEN and WITHMATCHLEN only affect IDX, and non-string keys return ERR The specified keys must contain string values.

OBJECT ENCODING and OBJECT REFCOUNT return the encoding and reference count for one key. The encoding uses Redis 8 defaults: int, embstr, or raw for strings, listpack or quicklist for lists (using an encoded listpack size estimate against the 8 KB list-max-listpack-size budget; the boundary is approximate because Redis also considers push history), listpack, listpackex, or hashtable for hashes, intset, listpack, or hashtable for sets, listpack or skiplist for sorted sets, and stream for streams. Because ReRu stores one representation per type, the reply is an advisory label rather than the physical layout. It is recomputed from current contents, so a value that shrinks below a threshold reports the compact encoding again, and in-place string writes (APPEND, SETRANGE, SETBIT) report the content-based label where Redis keeps raw. Hashes with field deadlines report listpackex. Redis keeps listpackex for the life of the hash once any field TTL was set; ReRu returns to listpack when the last deadline is cleared, deleted, or expires. OBJECT REFCOUNT always returns 1 because values are never shared between keys. OBJECT FREQ, OBJECT IDLETIME, and OBJECT HELP are not implemented.

AOF replay rewrites one key per batch. Collection keys are split by argument count and a 32 MiB payload budget. String values larger than that budget are written as a SET followed by APPEND chunks, so a string grown past the 256 MiB command cap by APPEND still replays (SETRANGE stops at the 64 MiB cap). A file written by an older build that stored such a value as one SET still cannot replay, and a large string is re-encoded on every write until BGREWRITEAOF. A dataset larger than 512 MiB cannot be snapshotted and returns MISCONF. A failed AOF write leaves the in-memory value in place, returns -MISCONF, and keeps the connection open. Snapshot key counts are bounded by the payload size instead of a fixed 1,000,000-key cap.

Memory limit and eviction

--maxmemory SIZE accepts bytes or k/kb, m/mb, and g/gb suffixes. The default 0 means unlimited. --maxmemory-policy accepts noeviction, allkeys-lru, allkeys-lrm, allkeys-lfu, allkeys-random, volatile-lru, volatile-lrm, volatile-lfu, volatile-random, and volatile-ttl. ReRu estimates logical dataset bytes from keys, values, and fixed per-entry overhead; this is not Redis allocator memory, process RSS, or an exact RAM ceiling. Allkeys policies may evict any live key. Volatile policies only evict live keys with expiry; a growing write returns OOM and rolls back if those candidates cannot free enough space. noeviction also rolls back growing writes on OOM, including their WATCH effects. Evictions invalidate WATCH and are included in ReRu snapshots and replication. Loaded snapshots are trimmed to the limit when an allkeys policy is selected; recency and frequency are not persisted.

LRU and LRM use exact in-memory order; LFU uses a simplified frequency counter with minute-based decay. Redis uses sampled eviction and a different LFU algorithm. Random policies pick from a shuffled candidate order, and volatile-ttl picks the earliest expiry. Memory accounting scans the dataset; bounded writes under noeviction and volatile policies copy it for rollback. These paths need further performance work. INFO memory reports the logical estimate as used_memory and reru_estimated_dataset_bytes; INFO stats reports evicted_keys. Additional supported fields are described below. CONFIG GET/SET supports the two memory settings and maxclients; runtime changes are not saved to a config file.

Background expiry and connection limits

Primaries reclaim idle expired keys using a deadline index with one record per expiring key. A worker attempts a cycle every 100 ms, processing up to 256 keys or 5 ms of index/deletion work while holding the command gate. Persistence and replication serialization are outside this time budget and can take longer. Busy commands can delay expiry. TTL changes replace the previous index entry; PERSIST, replacement, deletion and eviction remove it. Startup rebuilds the index. Deletion invalidates WATCH and follows the normal AOF/snapshot/replication path. Replicas receive primary deletions and do not run an independent expiry worker. This differs from Redis's sampled active-expiry algorithm.

INFO memory exposes reru_retained_keys (including expired entries not yet reclaimed) and reru_expiry_index_keys. INFO stats exposes reru_active_expired_keys, counting only keys physically removed by the worker. The index's memory overhead is not included in ReRu's logical maxmemory estimate.

--maxclients COUNT defaults to 10000 and requires a positive integer. Accepted connections, including replication and subscriptions, hold a slot until their handler exits. Excess clients receive ERR max number of clients reached. Blocking list and sorted-set commands ignore a type change alone and wake only when data becomes available; a wrong-type key that comes before any key with data errors, either on the first call or when another key supplies data. Blocking list, sorted-set and stream commands probe their TCP connection while waiting; a closed connection releases its client slot without waiting for a key change or command timeout. The probe does not consume pipelined request bytes. An OS-unreported half-open connection cannot be detected until TCP reports it. Lowering CONFIG SET maxclients keeps existing connections and rejects new ones until capacity becomes available. INFO clients reports connected_clients and maxclients; INFO stats adds total_connections_received and rejected_connections. Thread creation failures are logged. These limits do not bound transaction queues, Pub/Sub buffers, aggregate request memory or RSS.

List counts are validated the way Redis validates them: an unusable count for LPOP or RPOP, and an unusable RANK, COUNT or MAXLEN for LPOS, return Redis's error text, and a rejected count does not touch the key. BLMOVE and BRPOPLPUSH return a nil array when their timeout expires, and a nil bulk inside MULTI, where they run without blocking.

Integer command arguments use Redis's string2ll form: an optional -, no leading +, no leading zeros unless the value is exactly 0, and an i64 range. Values such as 010, +1 or -0 are rejected by INCRBY, indexes and counts for lists, sorted sets, hashes, bitmaps, streams, SELECT, HELLO, LMPOP/ZMPOP, scan COUNT, geo COUNT, and stream-group options such as XCLAIM IDLE/TIME/RETRYCOUNT, XAUTOCLAIM, XINFO STREAM COUNT, XGROUP CREATE ENTRIESREAD, and XSETID; those stream-group options use the generic value is not an integer or out of range text where Redis names the option. Two Redis parsers are lenient and stay lenient here: scan cursors accept +0, 00 and -0, and stream IDs accept a leading + or leading zeros in their millisecond part.

COPY supports same-database copy and REPLACE; DB selection is pending. Copying a key onto itself returns ERR source and destination objects are the same. FLUSHDB and FLUSHALL both clear ReRu's only database. ASYNC is accepted but deletion is currently synchronous; flush invalidates WATCH and is persisted through ReRu snapshots/AOF. UNLINK removes keys immediately but frees memory synchronously, unlike Redis's background reclamation. DBSIZE counts unexpired keys; the separate expiry worker reclaims idle keys. TOUCH updates the in-memory access order and frequency. KEYS and SCAN exclude expired keys. SCAN uses a sorted index offset as its cursor, applies MATCH and TYPE after selecting each page, and treats COUNT as a page-size hint. It rebuilds and sorts the live key list on every call, so large keyspaces need a more scalable cursor implementation. Changes to the keyspace during a scan can shift the index and repeat or skip keys.

Sorted sets keep a member lookup map and a score-ordered index. Score changes update both indexes. Rank lookup is still linear in the number of members; range scans advance through the ordered index. ZRANGE supports rank indexes, BYSCORE, BYLEX, REV, WITHSCORES, and LIMIT on applicable ranges. ZRANGESTORE reuses that selection, replaces the destination with the result, clears its TTL, and deletes it when nothing matches. LIMIT without BYSCORE or BYLEX is rejected with the same error Redis returns; options may appear in any order. A negative LIMIT offset selects nothing and a negative count means all, both as in Redis. Score bounds report ERR min or max is not a float, and an empty bound reads as zero; ZADD and ZINCRBY still reject an empty or unparsable score with ERR value is not a valid float. Hex-float literals such as 0x1, which Redis accepts through strtod, are rejected everywhere. Lex ranges use the score-ordered index and should be used with equal scores, the ordering condition documented by Redis. Score replies follow Redis's fpconv_dtoa rules: a value that fits exactly in half the i64 range prints as an integer, other values use shortest round-trip digits with Redis's fixed versus exponent thresholds. Digit selection is Rust's correctly rounded shortest form, not Grisu2, so about 0.1% of random high-precision values differ in trailing digits (sometimes a different last digit, sometimes fewer or more digits), and values between about 1e18 and 1e23 can print in exponent form where Redis keeps a fixed decimal (for example 1e23 is 1e+23 here and 99999999999999990000000 in Redis). Bitmap growth is capped at 64 MiB per value, below Redis's maximum; this is an explicit ReRu resource limit. BITFIELD and BITFIELD_RO support integer widths up to i64 and u63. Writes that would grow beyond ReRu's 64 MiB string cap fail. Read-only bitfield calls do not create a key; failed overflow operations leave it unchanged. Strings and bitmaps share the same underlying value type.

Sorted-set union/intersection/difference accept sorted-set and plain-set inputs. ZUNION and ZINTER support WEIGHTS, SUM/MIN/MAX/COUNT aggregation and WITHSCORES; store variants replace the destination and clear its TTL. ZINTERCARD supports LIMIT. COUNT aggregation was added to Redis in 8.8; the local Redis 7.0.15 comparison covers the other algebra options.

XDEL and exact XTRIM MAXLEN|MINID retain a stream's last generated ID when entries disappear. The ID survives ReRu snapshots and AOF replay. Approximate trimming (~), LIMIT, reference-aware trimming options, and newer stream features remain unimplemented. New stream snapshots use a revised type tag; new builds read older tags, but older builds cannot read new snapshots.

Vector sets

VADD accepts one binary member with VALUES <dimensions> or little-endian FP32 values. Dimensions are fixed at creation (1–65,536), and non-finite values are rejected before mutation. The default Q8 mode and NOQUANT mode cannot be mixed in one set. VEMB returns reconstructed values or RAW representation; VSIM ... TRUTH scans every member and supports COUNT and WITHSCORES. Empty sets disappear when their last member is removed.

The exact-search milestone does not implement HNSW approximate search, REDUCE, BIN, CAS, EF, M, SETATTR, WITHATTRIBS, FILTER, FILTER-EF, EPSILON, or NOTHREAD; those options return explicit errors. Numerical rounding and Q8 scores can differ slightly from Redis 8.10.2. A vector value participates in key expiry, DEL/COPY, WATCH/MULTI, maxmemory accounting, ReRu snapshots/AOF and ReRu replication. Snapshot tag 10 stores dimensions, Q8/F32 mode, binary member names and little-endian FP32 input components; the decoder rejects malformed, duplicate and non-finite entries. Redis RDB SAVE, BGSAVE and DUMP reject vector sets explicitly. Redis RDB vector-set import and RESTORE remain unsupported.

Behavior references: vector sets, VADD, VEMB, and VSIM.

HyperLogLog

PFADD accepts binary members and creates an empty sketch when called without members on a missing key. Non-string keys return the generic WRONGTYPE error, while a string whose header is not a valid sketch keeps the HyperLogLog-specific message. It returns 1 only when a key is created or a register changes; duplicate/no-op additions leave the stored bytes and WATCH unchanged. PFCOUNT returns zero for missing keys and estimates a multi-key union without creating a destination. PFMERGE includes the existing destination, supports aliased or missing source keys, and preserves the destination's TTL. All source values are validated before replacing the destination.

Sketches are Redis strings with the HYLL header, 16,384 six-bit registers, MurmurHash64A member hashing and the Ertl improved raw cardinality estimator. The commands estimate distinct counts; they do not retain members or provide exact counts, membership queries or element deletion.

New or changed sketches use a 12,304-byte dense value (including the header). Imported sparse strings are readable and remain unchanged on no-op PFADD; changes and PFMERGE produce dense storage. Redis's sparse update strategy, configurable sparse promotion threshold and SIMD optimizations are not implemented. This trades small-sketch memory efficiency for simpler storage.

Single-key PFCOUNT uses the cached cardinality when valid. Recomputing a dirty cache updates the string header, invalidates WATCH and persists/replicates that change, including inside EXEC. It remains a read command usable on replicas and above maxmemory. Multi-key counts never update source caches. As in Redis, a valid cache is trusted; arbitrary user edits to HYLL bytes can produce meaningless counts. Decoding rejects malformed sparse runs and dense register ranks above 51; the latter is stricter than Redis for manually corrupted values. Estimates exceeding the RESP signed-integer range saturate at i64::MAX.

Values participate in TTL, transactions, noeviction rollback, snapshots, AOF rewrite/replay, RDB, DUMP/RESTORE and ReRu replication through string storage. Tests compare 40,000 binary/text elements, cardinalities, union and merge results, dense bytes, sparse imports and DUMP exchange against Redis 7.0.15. These are representative interoperability checks, not a complete numerical proof or a large-scale performance benchmark.

References: Redis HyperLogLog, PFCOUNT, Ertl's estimator.

Stream consumer groups

XGROUP CREATE/SETID supports explicit IDs or $, optional ENTRIESREAD, and MKSTREAM for creation. CREATECONSUMER/DELCONSUMER manage consumers; deleting a consumer also removes its pending entries. DESTROY removes the group. Binary stream, group and consumer names are supported.

XREADGROUP GROUP group consumer supports multiple streams, COUNT, BLOCK and NOACK. > distributes new entries; explicit IDs replay that consumer's pending entries. Deleted or trimmed payloads remain pending and replay as null payloads. XACK removes pending references after resolving the key, type, and group, so ID syntax is checked only after those lookups. XDEL resolves the key and type the same way. XPENDING supports summary and range forms, IDLE, exclusive bounds and a consumer filter. XCLAIM supports IDLE, TIME, RETRYCOUNT, FORCE, JUSTID and LASTID, and registers its consumer even when it claims nothing. XCLAIM and XAUTOCLAIM accept a negative minimum idle time, and XCLAIM's IDLE/TIME/RETRYCOUNT errors name the option, and XCLAIM resolves the key, type, and group before parsing IDs and options. Redis can also reply Insufficient memory, failed allocating transient memory, COUNT too high. for an enormous XAUTOCLAIM COUNT; ReRu scans lazily and does not allocate a deleted-ID buffer, so it returns the bounded reply instead. Stream IDs are parsed as C strings: leading whitespace, a leading +, leading zeros, and a NUL terminator are accepted, while trailing bytes are not. Stream subcommand arity errors name the command or parent|subcommand, and unknown subcommands are reported. A few stream keyword comparisons remain exact rather than C-string (XADD/XTRIM/XGROUP/XAUTOCLAIM options with a NUL suffix), XAUTOCLAIM's start ID, XGROUP SETID, and XREAD IDs do not accept +/-, XGROUP DESTROY on a missing key replies 0, ENTRIESREAD uses the generic integer error and its reporting differs from Redis, and some XTRIM/XREAD arity and syntax texts still differ. XAUTOCLAIM implements bounded scanning (10 x COUNT), a COUNT shared by claims and deleted pending entries, JUSTID, the Redis 7 deleted-ID reply, and registers its consumer even when it claims nothing. These provide at-least-once processing primitives, not exactly-once application execution.

XINFO GROUPS/CONSUMERS/STREAM exposes group cursors, pending counts, consumers, entry counters and stream endpoints. STREAM FULL accepts COUNT (zero means all; a negative count uses the default 10) and returns entries plus group/consumer pending lists with delivery timestamps. ReRu uses a vector for streams: both radix-tree allocation metrics report zero. Consumer diagnostics include the Redis 7.2+ inactive/active-time fields. Newer Redis IDMP and negative-acknowledgement diagnostics are not implemented. Lag is inferred from counters and retained entries and can be unknown after deletion or cursor changes; complete parity for every history still needs validation.

XADD supports NOMKSTREAM and exact MAXLEN/MINID trimming, with optional =. Appending and trimming are atomic, preserve TTL, and retain pending references. XSETID supports ENTRIESADDED and MAXDELETEDID. Like the pinned Redis 8.10.2 source, it rejects an ID below the existing maximum deleted entry ID; Redis 7.0.15 permits that reset, so this case has a separate target-version test. Trimming does not advance the maximum explicitly deleted ID.

Group writes participate in transactions, WATCH, memory limits, snapshots, AOF and ReRu replication. BLOCK is ignored inside EXEC. Competing consumers receive distinct new entries. Closed blocking clients do not claim subsequent entries; FIFO waiter order remains pending. Group delivery is a mutation and is rejected on read-only replicas. New stream snapshot metadata preserves groups, ownership, retry counts and consumer/delivery timestamps. Old snapshots load without groups and approximate entries-added with the retained entry count. New snapshots require matching builds; old binaries cannot read the new stream type tag.

AOF rebuild recreates groups and pending entries using Redis commands, including trimmed or deleted payloads and explicitly reset stream IDs. Delivery timestamps and retry counts survive; consumer seen/active timestamps are recreated during replay, so idle diagnostics can reset. RDB streams are still unsupported.

Remaining stream work includes reference-aware trimming, XACKDEL/XDELEX/XNACK, XREADGROUP CLAIM, IDMP, additional options and stream RDB encodings.

Behavior references: XREADGROUP, XINFO STREAM, XSETID.

Persistence and replication

  • --dir DIR --dbfilename FILE loads Redis RDB at startup. SAVE writes synchronously; BGSAVE clones the dataset under the command lock and writes from a worker thread. A unique temporary file is synced and renamed over the destination only after complete encoding. LASTSAVE and INFO persistence report successful save time, in-progress state and last save status.
  • The RDB codec writes version 10 and accepts headers 6 through 15 only for supported encodings: plain strings/lists/sets/hashes/binary-score sorted sets, integer and LZF strings, intsets, hash/zset/set listpacks, and quicklist2 lists. CRC64 is verified (zero file checksums are allowed by the format). Geo data and bitmaps round-trip through their underlying zsets and strings. Expiry is stored as an absolute timestamp; expired keys are omitted on load.
  • RDB streams, zipmaps/ziplists/old quicklists, textual-score zsets, field TTL, modules, functions, newer specialized types, and nonzero databases are not supported. Loading these fails explicitly. Saving a dataset containing a stream fails without replacing the existing file. Header acceptance does not establish compatibility with every encoding of that Redis version.
  • DUMP/RESTORE transfer the same supported value types. RESTORE supports millisecond TTL, REPLACE and ABSTTL; IDLETIME/FREQ remain unsupported. Restored writes participate in WATCH, transactions, maxmemory, AOF and ReRu replication. Invalid payloads leave existing destination data intact.
  • RDB files and decoded string budgets are capped at 256 MiB, and key and collection counts at one million. There is no save schedule, shutdown save, automatic backup recovery, directory fsync, or AOF/RDB combination. SAVE and BGSAVE require explicit RDB configuration and are rejected inside MULTI. BGSAVE uses an in-memory copy, so large datasets can temporarily double RAM.
  • Optional --snapshot FILE saves strings, lists, streams, hashes, sets, sorted sets and absolute expiry deadlines and restores them at startup. EXPIRE, PERSIST and DEL changes are included. This is the custom RERUSNP1 format, not Redis RDB or AOF. New builds can load earlier snapshots. Older builds cannot load snapshots containing newer value types; use matching builds for these types.
  • Optional --appendonly FILE writes the resulting state of changed keys as RESP2 MULTI/EXEC command batches and replays complete batches at startup. It preserves binary data, types, and absolute expiry across restarts, and truncates an incomplete final batch. Each batch is synced to disk before the command response. This is a simple single-file AOF subset; it does not implement Redis 7 multipart AOF manifests, automatic rewrite thresholds, configurable fsync policy, or arbitrary external AOF import. It cannot be combined with --snapshot or --replicaof yet. Without manual compaction, files grow with writes.
  • Optional --replicaof HOST PORT provides read-only ReRu replicas, initial synchronization, subsequent full dataset snapshots and reconnection. CONFIG SET remains available on a replica; dataset writes do not, and eviction is skipped so a lowered maxmemory does not drop replicated keys.
  • Replication uses custom RERUREP1 frames with changed-key metadata. Use matching builds on both ends. Redis PSYNC, partial resynchronization, acknowledgments, WAIT and failover are not implemented.
  • Persistence errors do not roll back the in-memory command. Disk failure recovery and configurable durability policy need further work.

AOF compaction

BGREWRITEAOF requires AOF mode and starts a Rust worker thread. ReRu clones the dataset and records the current AOF offset under the command gate. The worker writes a compact RESP transaction to a unique adjacent temporary file. Client writes continue appending to the original file. At installation, the worker locks the command gate, copies the exact appended tail, syncs the temporary file, closes handles, and renames it over the original. Errors before replacement leave the original AOF intact; ordinary errors clean up the temporary file. Process termination may leave an unused temporary file, which startup ignores. Unix also syncs the containing directory; a directory-sync error after rename reports an error even though replacement has occurred. Windows power-loss durability needs further validation.

The worker preserves supported types, absolute expiry and stream last-generated IDs, consumer groups, pending ownership and delivery counts. Only one rewrite can run at a time. It is rejected inside MULTI and when AOF is disabled. ReRu does not implement Redis's RDB/rewrite scheduling or multipart manifest protocol. Dataset cloning temporarily increases memory usage; the initial clone and final tail copy/fsync block commands. Large workloads still need performance and crash-fault testing.

INFO persistence adds aof_enabled, aof_rewrite_in_progress, aof_last_bgrewrite_status, aof_rewrites (successful rewrites since startup), aof_current_size, and aof_base_size (size at startup or last successful rewrite). CONFIG GET appendonly and CONFIG GET appendfsync report the startup mode and fixed always fsync policy; changing these through CONFIG SET is unsupported.

Behavior reference: Redis BGREWRITEAOF.

Client connection lifecycle

The RESP2 parser accepts up to 1,048,576 arguments and 256 MiB of argument bytes per command. These are ReRu limits, below Redis's INT_MAX argument count, 512 MiB proto-max-bulk-len, and 1 GiB query buffer, and keep one command within the 512 MiB snapshot, RDB, and replication limits. Frames above either limit reply -ERR Protocol error: <reason> and close the connection. Empty frames (*0, *-1) are ignored. Malformed bulk and multibulk headers report Redis's matching reason, including the offending byte for expected '$' and expected '*'; a non-printable offending byte is shown as ?. Inline commands are not supported; a frame whose first byte is not * gets the expected '*' error and the connection closes. ReRu also rejects unexpected bytes after a bulk value, where Redis ignores them.

HELLO and HELLO 2 return a RESP2 properties array containing ReRu's actual name/version, protocol 2, stable connection ID, standalone mode, a role token of master on a primary or replica on a read-only replica, and an empty modules list. Redis keeps slave only in INFO replication, which ReRu does not implement yet. AUTH default password and SETNAME options are supported. All options are validated before authentication/name changes; failed credentials preserve an existing authenticated session. HELLO 3 returns NOPROTO without changing authentication or the protocol. RESP3 remains unimplemented.

CLIENT ID identifies the socket until disconnect, including across RESET. GETNAME returns nil when unnamed; SETNAME with an empty value clears the name. Names and library metadata accept printable ASCII without whitespace. SETINFO supports LIB-NAME and LIB-VER. INFO returns a subset: ID, peer/local addresses, name, age, database, default user, RESP version and library metadata. CLIENT LIST, KILL, UNBLOCK, TRACKING, detailed buffer metrics and other client operations remain pending. Metadata is local to the connection and is never persisted.

CLIENT REPLY ON|OFF|SKIP controls command replies per connection. OFF and SKIP produce no reply themselves; ON replies +OK. SKIP suppresses the next command reply, including an error; ON can restore replies immediately. SKIP has no effect while replies are OFF. RESET restores reply mode while respecting a pending SKIP. Subscription acknowledgements and published messages remain visible in subscribed mode, matching Redis even when ordinary command replies are disabled. Within EXEC, an embedded reply-mode change can suppress later element bytes while the declared array length remains unchanged, as observed in Redis 8.10.2.

SELECT 0 supports clients that explicitly select the default database. Nonzero databases fail explicitly; multiple logical databases remain unimplemented. With static Cluster enabled, SELECT 0 is accepted, other valid database indexes are rejected, and HELLO reports cluster mode. Connection commands can be queued in MULTI and executed in order without invalidating dataset watches. They are usable on read-only replicas.

RESET executes immediately, including in MULTI, during subscription mode and before authentication. It discards queued commands/errors, clears WATCH, removes channel/pattern subscriptions without extra unsubscribe replies, clears the client name and restores startup authentication requirements. Socket ID and library metadata remain. On a password-protected server, AUTH or HELLO AUTH is required again. RESET does not change replica read-only status or dataset data.

Tests cover session isolation, validation, authentication state, transaction errors, subscription cleanup and replicas. Common connection sequences pass against Redis 7.0.15. SETINFO is a newer command tested locally against the specified behavior; its reference-server comparison remains pending.

References: HELLO, RESET, CLIENT SETINFO, CLIENT REPLY.

Authentication

--requirepass PASSWORD or --requirepass-file FILE configures the default user's password at startup. An empty password means nopass mode. Files are limited to 4096 bytes and strip a single trailing LF or CRLF; remaining bytes, including spaces and binary bytes, are part of the password. The last supplied password option wins. Prefer file options to avoid credentials appearing in process arguments.

Unauthenticated connections receive NOAUTH for commands other than AUTH, HELLO, RESET and QUIT, including replication handshakes, subscriptions, configuration and transactions. AUTH password and AUTH default password authenticate one connection. Invalid credentials return WRONGPASS and preserve any existing authenticated session. With no configured password, named default-user AUTH succeeds, while legacy password-only AUTH returns Redis's no-password error. AUTH can be queued in an authenticated transaction and is rejected in RESP2 subscribed mode. ACL WHOAMI returns default; no other ACL subcommands or per-user rules are implemented.

--masterauth PASSWORD or --masterauth-file FILE authenticates a replica to its primary before the custom REPLSYNC handshake, including reconnects. Replica client passwords are independent. Wrong upstream credentials prevent synchronization. Secrets are not included in persistence, CONFIG GET or INFO output. Comparison uses the subtle crate; configured secrets remain in process memory. There is no TLS, authentication rate limiter, password rotation, ACL persistence, multi-user support, or runtime CONFIG SET requirepass/masterauth yet.

Behavior references: AUTH and ACL WHOAMI.

Pub/Sub

Messages are delivered to current subscribers on the same server process. Pattern subscriptions use byte-wise, case-sensitive *, ?, bracket ranges, and backslash escapes. PUBSUB NUMPAT reads a reference-counted pattern map, so repeated and shared patterns count once in constant time. A direct and matching pattern subscription on one client receive separate messages, and PUBLISH counts both. Subscribed RESP2 clients can issue subscription commands, PING, RESET and QUIT. Subscription commands inside MULTI are queued and executed by EXEC, which nests their acknowledgements in its reply and leaves the connection subscribed; an invalid subscription arity aborts the transaction. Disconnects remove their subscriptions. Delivery is at-most-once; messages are not persisted or replicated, and clients on other ReRu servers do not receive them. Each subscriber's output is buffered per connection and written by its own thread, so acknowledgements and messages are queued whole and never interleave; a publish does not wait for a slow reader and does not skip a live listener. The writer waits for a paused reader as long as the buffer stays within limits; a subscriber is disconnected when its buffered output exceeds 32 MiB, or when it stays above 8 MiB for 60 seconds (checked by the writer once per second). A message published to the client's own channels during EXEC is held and delivered after the transaction reply. Sharded Pub/Sub, keyspace notifications, and Pub/Sub ACLs remain pending. RESET clears subscriptions and returns the connection to ordinary RESP2 command mode.

Verification for this increment

The local suite has 359 tests: 34 unit tests in src/main.rs, 5 in src/lib.rs, and 320 server integration tests. Sorted-set tests compare ZRANGESTORE output with the matching ZRANGE for rank, score and lex ranges, and cover destination replacement, cleared TTL, deletion on an empty result, and rejected arity, syntax and wrong types. It covers binary values, wrong types, score ordering and updates, bitmap ranges, SET conditions and expiry, multi-key atomicity, WATCH/MULTI/EXEC, snapshot restart, AOF replay and partial tails, replica updates, and malformed snapshot payloads. Earlier keyspace, list, stream, hash, set, and transaction regression tests remain. Eviction tests cover OOM rollback, WATCH, transactions, policy selection, INFO counters, access order, runtime configuration, and snapshot restart. Keyspace tests cover rename/copy TTL, noeviction rollback, WATCH, TOUCH/LRU, and blocking-list wakeup. Formatting and Clippy are checked. Cache lifecycle tests check idle reclamation across multiple batches, rescheduled and cancelled TTLs, OOM rollback, WATCH invalidation, restart index rebuilding, AOF/snapshot deletion and replica propagation. Client-limit tests check rejection, QUIT/disconnect/malformed-request cleanup, atomic configuration validation, and lowering/raising limits without dropping existing clients. AOF rewrite tests cover log compaction, all supported types, binary values, expiry and stream ID preservation, writes/transactions/flush during rewriting, restart, exact appended-tail copying, failed replacement, command validation, status fields and retry after an unavailable source file. Authentication tests cover pre-auth command/replication rejection, per-connection state, failed reauthentication, transactions, subscriptions, binary password files, restart, credential exclusion from AOF, and protected primary/replica connections. The differential suite also checks nopass AUTH and ACL WHOAMI against Redis.

Consumer-group tests cover delivery ownership, NOACK, history, tombstones, acknowledgements, claiming, blocking/timeouts, concurrent consumers, diagnostics, TTL, WATCH, OOM rollback, restart/rewrite and replica updates. An additional reference-dependent test compares group command sequences and XADD options against Redis 7.0.15; it skips comparisons if the reference port is unset.

HyperLogLog tests add binary members, merge aliasing, malformed input, cached counts/WATCH, sparse-to-dense OOM rollback, expiry, persistence, replication and a fourth reference-dependent comparison with Redis. Two unit tests cover packed register boundaries and malformed sparse runs.

Connection tests cover HELLO option validation, per-socket metadata, password reset, queued connection commands, WATCH/subscription cleanup and read-only replicas. A fifth reference-dependent test compares common connection sequences.

The suite includes an optional deterministic RESP2 differential test covering representative strings, lists, hashes, sets, sorted sets, streams, and transactions. It passed against a local Redis 7.0.15 instance with RERU_REDIS_REFERENCE_PORT=6391 cargo test --test redis_differential. Without the environment variable, that test skips its comparisons. The pinned 8.10.2 release and a much broader behavior corpus still need verification.

RDB integration tests cover save/restart, background saving, binary data, TTL, invalid checksums, failed replacement, WATCH, transactions, OOM rollback, and AOF restart. With RERU_REDIS_REFERENCE_PORT set, the RDB suite exchanges DUMP payloads with Redis 7.0.15, including compressed and integer strings, quicklist2, intset, hash listpack and sorted-set listpack encodings. Without that variable, this reference-dependent test also skips comparisons. scripts/test_rdb_interop.py additionally creates dedicated temporary servers, exchanges complete RDB files in both directions, and runs redis-check-rdb. Run instructions are in interoperability testing.

Two-node Cluster milestone

Two --cluster-node ID@IP:PORT@START-END flags opt in to an initial two-primary slot map. IDs are 40 hexadecimal characters; the ranges must partition all 16,384 slots and one endpoint must match the local listener. CLUSTER KEYSLOT uses CRC16/XMODEM and Redis hash tags. CLUSTER SHARDS and CLUSTER SLOTS report both configured owners as RESP2 arrays. Keyed commands are served only by their slot owner; a request to the other node receives MOVED. Multi-key commands and queued transactions spanning slots receive CROSSSLOT before mutating data. Persisted keys outside owned or importing slots cause startup to fail. The two-node integration tests cover these replies, binary keys, topology, transaction atomicity, malformed maps, and standalone behavior.

--cluster-state FILE is required for CLUSTER SETSLOT; each node must use its own path. It atomically stores 16,384 owners and local MIGRATING/ IMPORTING states. On a migrating source, present keys remain available and missing keys return ASK. The target accepts one redirected command after connection-local ASKING (through EXEC when followed by MULTI); other clients receive MOVED. Mixed-location multi-key commands return TRYAGAIN. MIGRATE HOST PORT KEY 0 TIMEOUT supports only the configured peer and database 0. It sends a ReRu snapshot value, including binary contents and absolute expiry. The source deletes only after the target has acknowledged its persisted write. Target memory eviction never evicts an imported key before acknowledgment; if it cannot fit, migration fails with OOM and the source keeps its key. A failed connection or timeout leaves the source key intact; an existing target key returns BUSYKEY and requires operator resolution before retry. COPY, REPLACE, KEYS, authentication to the peer, arbitrary hosts, and Redis wire-compatible MIGRATE are outside this milestone. Ownership changes must be applied on both nodes after transferring all keys in the slot.

This is not full Redis Cluster: nodes do not exchange topology, detect failures, elect a new primary, or perform automatic resharding. Cluster replicas and multiple logical databases are unsupported. CLUSTER SLOTS includes an empty metadata field for each node; detailed endpoint metadata and dynamic replication offsets are not yet available. Only explicit, contiguous initial ranges are accepted. A two-node Redis 8.10.2 comparison checked four slot vectors, the RESP2 topology shape, MOVED, CROSSSLOT, WATCH, SELECT, and transaction replies; broader Cluster interoperability remains untested.

Behavior references: cluster specification, CLUSTER KEYSLOT, CLUSTER SHARDS, and CLUSTER SLOTS, CLUSTER SETSLOT, and MIGRATE.

Remaining major work

Additional sorted-set and bitmap commands, geo indexing, newer stream features, sharded Pub/Sub, scripting, broader command options, full Redis RDB/AOF, PSYNC, multi-user ACLs, TLS, RESP3, dynamic cluster/failover, Redis-exact eviction internals, bounded resource usage and performance engineering remain. Blocking clients do not yet receive Redis's FIFO waiter guarantees. Redis RDB hash-field expiry and broader hash, list and set command options are also pending.

Behavior references: HSET, HINCRBY, SADD and SMEMBERS.

Follow the roadmap and team plan. The PDF records the earlier planning baseline; this inventory tracks subsequent implementation progress.