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 @@ -10,6 +10,10 @@ Because ReRu is pre-1.0, minor versions may include breaking changes.

### Added

- Added manual two-node Cluster slot migration with persistent ownership,
`CLUSTER SETSLOT`, connection-local `ASKING`, `ASK`/`TRYAGAIN` routing and
acknowledged ReRu-to-ReRu `MIGRATE` with binary values and TTLs.

- Added bounded Q8/FP32 vector sets with `VADD`, `VCARD`, `VDIM`, `VEMB`,
`VREM`, and exact `VSIM ... TRUTH`, including key expiry, transactions,
maxmemory rollback, ReRu snapshot/AOF persistence and replication.
Expand Down
7 changes: 6 additions & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ authentication settings, and the pub/sub hub.
| --- | --- |
| `main.rs` | Core types, command dispatch, blocking helpers, client loop, startup |
| `command_table.rs` | Metadata for `COMMAND`, `COMMAND COUNT`, and `COMMAND INFO` |
| `cluster.rs` | Static slot map, CRC16/hash tags, routing, and topology replies |
| `cluster.rs` | Two-node slot ownership, migration states, routing, transfer, and topology replies |
| `lib.rs` | Library root; exports `protocol` for out-of-tree tooling such as `fuzz/` |
| `protocol.rs` | RESP2 reader and reply writers; size and argument limits |
| `connection.rs` | `HELLO`, `SELECT`, `CLIENT`, `RESET`, per-socket metadata |
Expand Down Expand Up @@ -107,6 +107,11 @@ parsed command and the store, and return raw RESP bytes.
`is_mutating` decides whether persistence runs, and `save_and_publish`
writes the snapshot/AOF and forwards the change to replicas.

Cluster mode stores per-slot ownership and local migration state in a separate
atomic `--cluster-state` file. A client connection carries one-command `ASKING`
state. `MIGRATE` sends one ReRu snapshot value to the configured peer; the
target commits it before replying, and the source deletes only after `+OK`.

## Persistence and replication pipeline

`save_and_publish` is the single write-out point:
Expand Down
14 changes: 9 additions & 5 deletions docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ usage: reru [--port PORT] [--bind ADDRESS] [--snapshot FILE] [--appendonly FILE]
[--requirepass PASSWORD | --requirepass-file FILE]
[--masterauth PASSWORD | --masterauth-file FILE]
[--maxmemory SIZE] [--maxmemory-policy POLICY] [--maxclients COUNT]
[--cluster-node ID@IP:PORT@START-END]...
[--cluster-node ID@IP:PORT@START-END]... [--cluster-state FILE]
```

Flags are space-separated (`--port 6380`, not `--port=6380`). Every flag takes a
Expand All @@ -37,6 +37,7 @@ usage text above.
| `--maxmemory-policy POLICY` | `noeviction` | Eviction policy |
| `--maxclients COUNT` | `10000` | Maximum concurrent connections |
| `--cluster-node ID@IP:PORT@START-END` | off | Add a static Cluster owner (exactly two entries required) |
| `--cluster-state FILE` | off | Persist per-node slot ownership and migration state |
| `--help`, `-h` | - | Print version and usage |
| `--version`, `-V` | - | Print version |

Expand Down Expand Up @@ -74,15 +75,18 @@ usage text above.
- `--cluster-node ID@IP:PORT@START-END` — provide exactly two nodes with unique
40-hex IDs and non-overlapping, contiguous ranges covering slots 0–16383.
One address must match `--bind` and `--port`; each node starts with the same
map. This experimental mode supports routing and topology only, not gossip,
migration, replicas, or failover. See [compatibility status](COMPATIBILITY.md#static-cluster-milestone).
map. This experimental mode supports manual migration with a separate
`--cluster-state` file per node. It does not support gossip, replicas, or
failover. See [compatibility status](COMPATIBILITY.md#two-node-cluster-milestone).
- `--cluster-state FILE` — required for live `CLUSTER SETSLOT` changes; write
an atomic local owner and migration-state file for this node.

For a local two-node setup, start two processes with the same map and different
`--port` values:

```sh
reru --port 7001 --cluster-node 1111111111111111111111111111111111111111@127.0.0.1:7001@0-8191 --cluster-node 2222222222222222222222222222222222222222@127.0.0.1:7002@8192-16383
reru --port 7002 --cluster-node 1111111111111111111111111111111111111111@127.0.0.1:7001@0-8191 --cluster-node 2222222222222222222222222222222222222222@127.0.0.1:7002@8192-16383
reru --port 7001 --cluster-node 1111111111111111111111111111111111111111@127.0.0.1:7001@0-8191 --cluster-node 2222222222222222222222222222222222222222@127.0.0.1:7002@8192-16383 --cluster-state node-7001.state
reru --port 7002 --cluster-node 1111111111111111111111111111111111111111@127.0.0.1:7001@0-8191 --cluster-node 2222222222222222222222222222222222222222@127.0.0.1:7002@8192-16383 --cluster-state node-7002.state
```
- `--help`, `-h`, `--version`, `-V` — print the version plus usage line and exit
without starting the server. They are only recognized as the sole argument;
Expand Down
40 changes: 30 additions & 10 deletions docs/COMPATIBILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ tests; it does not certify complete compatibility with Redis.
| 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`](https://redis.io/docs/latest/commands/command/), `COMMAND COUNT`, `COMMAND INFO` | Lists ReRu's implemented command metadata, counts entries, or looks up names |
| Static Cluster | `CLUSTER KEYSLOT`, `CLUSTER SHARDS`, `CLUSTER SLOTS` | Explicit two-node slot map, hash tags, RESP2 topology, local routing, MOVED/CROSSSLOT; no discovery or failover |
| 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
Expand All @@ -44,7 +44,7 @@ entries, and `COMMAND COUNT` counts those entries. Redis documents
[`COMMAND COUNT`](https://redis.io/docs/latest/commands/command-count/), and
[`COMMAND INFO`](https://redis.io/docs/latest/commands/command-info/).

Total: **234 Redis command metadata entries**, or **51.0% name presence**
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`
Expand Down Expand Up @@ -686,33 +686,53 @@ that variable, this reference-dependent test also skips comparisons.
exchanges complete RDB files in both directions, and runs `redis-check-rdb`.
Run instructions are in [interoperability testing](INTEROP_TESTING.md).

## Static Cluster milestone
## Two-node Cluster milestone

Two `--cluster-node ID@IP:PORT@START-END` flags opt in to a fixed two-primary
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. Existing persisted keys outside the node's slots cause startup
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.

This is **not full Redis Cluster**: nodes do not exchange topology, migrate
slots or data, detect failures, elect a new primary, or implement `ASK` and
`ASKING`. Cluster replicas and multiple logical databases are unsupported.
`--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 ranges are accepted. A two-node Redis 8.10.2
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](https://redis.io/docs/latest/operate/oss_and_stack/reference/cluster-spec/),
[CLUSTER KEYSLOT](https://redis.io/docs/latest/commands/cluster-keyslot/),
[CLUSTER SHARDS](https://redis.io/docs/latest/commands/cluster-shards/), and
[CLUSTER SLOTS](https://redis.io/docs/latest/commands/cluster-slots/).
[CLUSTER SLOTS](https://redis.io/docs/latest/commands/cluster-slots/),
[CLUSTER SETSLOT](https://redis.io/docs/latest/commands/cluster-setslot/), and
[MIGRATE](https://redis.io/docs/latest/commands/migrate/).

## Remaining major work

Expand Down
Loading
Loading