Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ Because ReRu is pre-1.0, minor versions may include breaking changes.
AOF replay, and replicas. `EXPIRETIME` rounds the absolute second half up.
- AOF string values larger than the replay budget are written as a `SET` plus
`APPEND` chunks, so a string grown past the protocol bulk limit replays.
- Pub/Sub output is buffered per subscriber and written by its own thread, so a
paused reader receives the whole frame instead of a truncated one. Publish no
longer skips a live listener; a subscriber is dropped only above 32 MiB of
buffered output or after staying above 8 MiB for 60 seconds.
- `PUBSUB NUMPAT` reads a reference-counted pattern map instead of rebuilding a
set of every listener's patterns on each call.
- `BZPOPMIN`, `BZPOPMAX`, and `BZMPOP` stay blocked when a watched key only
Expand Down
24 changes: 12 additions & 12 deletions docs/COMPATIBILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tests; it does not certify complete compatibility with Redis.
| 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. Output is not buffered: a publish gives all subscribers 100 ms in total and a subscription batch 750 ms before a stalled subscriber is disconnected, which may leave a partial frame. A publish that exhausts its 100 ms leaves later subscribers unserved for that message |
| 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`](https://redis.io/docs/latest/commands/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 |
Expand Down Expand Up @@ -615,21 +615,21 @@ 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. Writes to a
subscriber socket are synchronous: acknowledgements get 100 ms of idle progress
within a 750 ms batch, and an `EXEC` reply from a subscribed client uses the same
budget so a stalled client is dropped instead of blocking the server, and
deferred deliveries are flushed afterwards with their own bound. A message
published to the client's own channels during `EXEC` is held and delivered after
the transaction reply. Slow-client buffering and backpressure do not yet match
Redis. Sharded Pub/Sub, keyspace
notifications, and Pub/Sub ACLs remain pending. RESET clears subscriptions and
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 **264 tests**: 28 unit tests in `src/main.rs`, 3 in
`src/lib.rs`, and 233 server integration tests.
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.
Expand Down
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1986,15 +1986,14 @@ fn handle_client(mut stream: TcpStream, store: Store) -> io::Result<()> {
.iter()
.any(|command| pubsub::is_subscription_command(command));
let holds = subscribes || subscription.active();
let deadline = Instant::now() + pubsub::ACK_TOTAL;
if holds {
subscription.hold();
}
for queued_command in queued {
let result = if queued_command[0].eq_ignore_ascii_case(b"AUTH") {
store.auth.authenticate(&queued_command, &mut authenticated)
} else if pubsub::is_subscription_command(&queued_command) {
subscription.change_frame(&queued_command, deadline)?
subscription.change_frame(&queued_command)?
} else if queued_command[0].eq_ignore_ascii_case(b"PING")
&& subscription.active()
{
Expand Down
Loading
Loading