- 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>
62 lines
3.2 KiB
Markdown
62 lines
3.2 KiB
Markdown
# Implementation Plan: Multi-Raft (Static → Split → Move)
|
||
|
||
**Branch**: `004-multi-raft` | **Date**: 2024-XX-XX | **Spec**: specs/004-multi-raft/spec.md
|
||
**Input**: Feature specification from `/specs/004-multi-raft/spec.md`
|
||
|
||
## Summary
|
||
- Goal: Rust/Tonic/RocksDBベースのRaft実装をMulti-Raftへ拡張し、PD配布メタに従う静的複数Region起動、閾値Split、ConfChangeによるRegion移動までを扱う。
|
||
- Approach: StoreコンテナでRegionID→Peerを管理、Raft/KVのルータをRegion対応にリファクタ。Splitは閾値検知→Splitコマンド合意→メタ更新→新Peer登録。MoveはPD指示に基づきConfChange(追加→キャッチアップ→削除)。
|
||
|
||
## Technical Context
|
||
- **Language/Version**: Rust stable (toolchain per repo)
|
||
- **Primary Dependencies**: tonic/prost (gRPC), raft-rs, RocksDB, tokio
|
||
- **Storage**: RocksDB(CF/キーにRegionIDプレフィックスで分離)
|
||
- **Testing**: cargo test(unit/integration)、Raft/KV多Regionのシナリオテスト
|
||
- **Target Platform**: Linux server (Nix flake環境)
|
||
- **Project Type**: backend/server (single workspace)
|
||
- **Performance Goals**: リーダー選出≤60s、Split適用≤60s、移動完了≤5分(成功率99%以上)
|
||
- **Constraints**: 憲法に従いテスト必須・gRPCエラーは構造化ログ・互換性影響を明示
|
||
- **Scale/Scope**: Region数: 最低複数同時稼働、将来数千を想定(バッチ最適化は後フェーズ)
|
||
|
||
## Constitution Check
|
||
- Test-First: 新機能ごとにユニット/インテグレーションテストを先行作成。
|
||
- Reliability & Coverage: `cargo test` 必須、複数Region・Split・ConfChangeの経路にテストを追加。
|
||
- Simplicity: まず静的Multi-Raft→Split→Moveを段階実装。バッチ化などは後続。
|
||
- Observability: Raft/KV/PD連携で失敗時に理由をログ。
|
||
- Versioning: Raft/PD RPC変更は契約として明示。
|
||
→ 憲法違反なしで進行可能。
|
||
|
||
## Project Structure
|
||
|
||
### Documentation (this feature)
|
||
```text
|
||
specs/004-multi-raft/
|
||
├── plan.md # This file
|
||
├── research.md # Phase 0
|
||
├── data-model.md # Phase 1
|
||
├── quickstart.md # Phase 1
|
||
├── contracts/ # Phase 1
|
||
└── tasks.md # Phase 2 (via /speckit.tasks)
|
||
```
|
||
|
||
### Source Code (repository root)
|
||
```text
|
||
rdb-server/src/
|
||
├── main.rs # entry
|
||
├── store.rs # (new) Store/Region registry & dispatch
|
||
├── peer.rs # Raft Peer (per Region)
|
||
├── peer_manager.rs # Raft message clients
|
||
├── raft_service.rs # gRPC service (region-aware dispatch)
|
||
├── service.rs # KV service (region routing)
|
||
├── raft_storage.rs # Raft storage (Region-prefixed keys)
|
||
├── merkle.rs # (existing) sync helpers
|
||
└── config/… # namespace/mode config
|
||
|
||
rdb-proto/src/ # proto definitions
|
||
tests/ # integration (multi-region, split, move)
|
||
```
|
||
|
||
**Structure Decision**: 単一バックエンド構成。Store/PeerにRegion対応を追加し、既存rdb-server配下にstore.rs等を拡張する。
|
||
|
||
## Complexity Tracking
|
||
- 現時点で憲法違反なしのため記載不要。
|