update documents

This commit is contained in:
Rongsong Shen 2026-08-10 17:51:51 +08:00
parent c705cadadc
commit d70bf6a402
51 changed files with 995 additions and 1997 deletions

View file

@ -1,3 +1,5 @@
> **ARCHIVED — superseded.** This planned a single-controller WAL (40-byte header, fsync pthread) plus a dual-zarray copy-on-write freeze/thaw checkpoint mechanism, with HA/replication deferred to the companion P1–P3 plans (fan-out TCP, single-ACK). What actually shipped: the WAL/persist.c core survived and evolved, but checkpoint consistency uses table-level + per-entity RTTI_LOCK_READ/WRITE nesting, not the COW freeze/thaw path described here (confirmed by `.kiro/specs/ha-entity-snapshots`, which explicitly notes COW entity enumeration was a documented non-goal). Replication/HA is quorum-based Raft, not the fan-out/single-ACK design in the P1–P3 plans — see the closed specs `raft-library`, `raft-ha-core-safety`, `raft-log-replication`, `raft-commit-safety`, `ha-term-safety`, `ha-single-leader-role`, `ha-commit-engine`, `ha-commit-durability`, `ha-commit-barrier-rollout`.
# P0: Single-Controller Persistence — Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

View file

@ -1,3 +1,5 @@
> **ARCHIVED — superseded.** This planned an LSF-style priority election (blocking `am_i_primary()` probes + dedicated watchdog pthread for self-promotion) on top of the pre-Kiro persistence-and-ha-design.md. What actually shipped is quorum-based Raft: `am_i_primary()` was deleted and replaced by `ha_start_election_async` (see closed specs raft-library, election-iomgr-refactor, raft-ha-core-safety, ha-prevote, raft-log-replication, raft-commit-safety, ha-term-safety, ha-single-leader-role), with real voting/term logic in `src/lib/raft/raft.c`. A few surface artifacts (`ha_init`, `ha_promote_to_primary`, `my_priority` as peer index, `E_XCE_REDIRECT`/`E_XCE_NOMASTER`, join.c redirect) survived in similar form but were rearchitected around Raft.
# P1: HA Foundation — Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use `superpowers:subagent-driven-development` or `superpowers:executing-plans` to implement this plan task-by-task.

View file

@ -1,3 +1,5 @@
> **ARCHIVED — superseded.** This planned a custom fan-out TCP replicator (`repl_wait_ack()` unblocking on any single standby's `OP_replAck`, plain WAL-copy `OP_replEntry` streaming, no Raft term concept). What actually shipped is majority-quorum Raft: `repl_wait_majority_ack()` delegating to a commit engine, and `repl_broadcast()`/`repl_send_append_entries()` carrying Raft terms through `raft_on_append_entries_request`. See closed specs `ha-commit-engine`, `raft-log-replication`, `raft-commit-safety`, `ha-term-safety`, `ha-commit-barrier-rollout`, `ha-single-leader-role`.
# P2: Replication (Fan-Out TCP) — TDD Implementation Plan
**Branch**: `persistent_ha`

View file

@ -1,3 +1,5 @@
> **ARCHIVED — superseded.** This planned hardening/test coverage for the pre-Raft HA design: single-primary promote/demote via plain term-increment (no election/voting) and single-ACK sync replication (`persist_wal_sync_append` + `repl_wait_ack`, no majority quorum). The real HA implementation that shipped is quorum-based Raft with prevote and majority-ack commit — see closed specs `raft-library`, `ha-prevote`, `raft-log-replication`, `raft-commit-safety`, `ha-term-safety`, `ha-single-leader-role`, `ha-commit-engine`, and `ha-commit-durability`. (Some of this doc's infrastructure ideas, e.g. `ctrl_metrics.c`'s metric names and the promote/demote/redirect function names, did land and still exist in `src/controller/ha.c`, but `ha_promote_to_primary` is now explicitly the "NON-RAFT" legacy/bootstrap road, not the primary election mechanism.)
# P3: Integration & Hardening — TDD Implementation Plan
**Branch**: `persistent_ha`

View file

@ -1,3 +1,5 @@
> **ARCHIVED — superseded.** This phase map planned dual-zarray COW checkpointing, LSF-style priority-list election, and single-standby-ACK durability for HA. What actually shipped instead: capnp-frame checkpoints (`ha-entity-snapshots`), full quorum-based Raft consensus (`raft-library`, `raft-ha-core-safety`, `ha-prevote`, `election-iomgr-refactor`, `raft-log-replication`, `raft-commit-safety`, `ha-term-safety`, `ha-single-leader-role`), and majority-quorum commit (`ha-commit-engine`, `ha-commit-durability`, `ha-commit-barrier-rollout`) — all closed `.kiro/specs/`. See the SUPERSEDED notes in `src/docs/persistence-and-ha-design.md` (Parts 3, 5, and the durability section) for details.
# XCE Persistence & HA — Implementation Overview
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

View file

@ -1,3 +1,5 @@
> **ARCHIVED — superseded.** This plan proposed a priority-based `am_i_primary()` election (non-blocking connect/poll probing with xorshift jitter) and a standalone single-ACK `OP_replConfigPush` fan-out (500ms timeout, no WAL involvement) for config replication. What actually shipped: primary election is quorum-based Raft (`ha_start_election_async`, replacing the now-deleted `am_i_primary`/`am_i_primary_quorum`/`probe_ctx_t` — see closed specs `election-iomgr-refactor`, `raft-log-replication`, `raft-commit-safety`, `ha-term-safety`), and config changes now travel as `WAL_CONFIG_MARKER` entries inside the Raft/WAL commit path (`ha-term-safety` task 4.1, `ha-commit-engine`) rather than an out-of-band push. The HEAD-file/SHA-256 versioned storage layer (`conf_save_config`, `conf_read_current_filename`, `config_repl.c`) did ship largely as described here and is still current.
# Config Replication Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

View file

@ -1,3 +1,5 @@
> **ARCHIVED — superseded.** This planned raw-byte capnp shims, a `conf_save_config()` path fix, and a 500ms-timeout push fan-out for the original single-ACK, non-quorum config-push/pull design in `config-replication-design.md` Phase 1. Verified against current source: the path fix and `wait_all_with_timeout()`/`handle_config_request()→xce_replconfig_reply_raw()` shipped close to as-designed, but `do_one_config_fetch()` was replaced by a differently-named probe path and, more importantly, the whole commit model was superseded — success now requires a WAL_CONFIG_MARKER reaching the majority-quorum committed prefix via `config_commit_change()`, per the closed `config-upgrade-snapshot`, `ha-term-safety`, and `ha-commit-barrier-rollout` specs.
# Config Replication — Wire Protocol Completion + Bug Fixes
> **SDD Plan** — Subagent-Driven Development