photoncloud-monorepo/flaredb/specs/004-multi-raft/quickstart.md
centra 8f94aee1fa Fix R8: Convert submodule gitlinks to regular directories
- Remove gitlinks (160000 mode) for chainfire, flaredb, iam
- Add workspace contents as regular tracked files
- Update flake.nix to use simple paths instead of builtins.fetchGit

This resolves the nix build failure where submodule directories
appeared empty in the nix store.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 16:51:20 +09:00

44 lines
1.5 KiB
Markdown

# Quickstart: Multi-Raft (Static → Split → Move)
## Prerequisites
- Nix or Rust toolchain per repo.
- PD stub runs inline (tests use in-memory).
## Run tests (recommended)
```bash
nix develop -c cargo test -q rdb-server::tests::test_multi_region
nix develop -c cargo test -q rdb-server::tests::test_split
nix develop -c cargo test -q rdb-server::tests::test_confchange_move
```
Or full suite:
```bash
nix develop -c cargo test -q
```
## Manual smoke (single node, two regions)
1. Launch PD stub (or ensure `pdpb` gRPC reachable).
2. Start server:
```bash
nix develop -c cargo run -p rdb-server -- --pd-endpoint http://127.0.0.1:50051
```
3. Verify routing:
- Put key `b"a"` → Region1
- Put key `b"z"` → Region2
## Trigger split (dev)
1. Run `test_split` or fill a region with writes.
2. Observe log: `ApplyCommand::Split` and new region registered.
## Move (rebalance) flow (simplified)
1. Source store handles region; target store starts with PD meta.
2. PD issues `MoveRegion(region_id, from=src, to=dst)`.
3. Source adds replica on target (ConfChange Add); target catches up; source can later remove itself (ConfChange Remove).
4. Verify data on target:
```bash
nix develop -c cargo test -q move_region_replica_carries_data -- --nocapture
```
## Notes
- Key ranges must not overlap; nodes validate PD meta.
- Raft logs and hard-state are prefixed by `region_id` to isolate shards.
- Pending eventual writes are forwarded to leaders; local queue persists to disk to survive restart.