Implements plan §4 "Rebalancer" background task: - Advisory lock via leader_lease (only one pod runs the rebalancer) - Reacts to topology change events (node add/drain/fail/recover) - Computes affected shards using the Phase 1 router - Drives the migration state machine for each affected shard - Updates Prometheus metrics (plan §10) - Progress persistence via jobs table for resumability Key features: - Per-index leader lease scope (rebalance:<index>) - Per-shard migration state machine with 7 phases - Concurrency bound via max_concurrent_migrations config - Cancellation support (pause/resume in-progress rebalancing) - Metrics: miroir_rebalance_in_progress, documents_migrated_total, duration_seconds Integration: - Admin API endpoints (POST /_miroir/nodes, drain, remove) send events to worker - Health checker syncs rebalancer metrics to Prometheus - Worker loads persisted jobs on startup for crash recovery Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| miroir-core | ||
| miroir-ctl | ||
| miroir-proxy | ||