feat(controller-status): off-primary learned committed + responder timestamp in ctrlstatus_fill (task 6.2)
Role-branch the committed sourcing: PRIMARY reports its own authoritative persist.committed_lsn / committed_config_tag; off-primary reports the LEARNED ha->last_known_committed_lsn / last_known_committed_config_tag instead of the primary-only raw markers that read 0 on a standby (fixes the applied>committed inversion). Stamp responder_time_ms from CLOCK_REALTIME for log correlation. Read-only (Req 10.1-10.4, 11.1). 4 new TDD tests; controller suite 110/0/0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
65ddafeb66
commit
3799bd6af4
3 changed files with 183 additions and 8 deletions
|
|
@ -70,7 +70,7 @@
|
|||
- Observable: the build regenerates `controller.capnp.h/.c` clean, the typemap matches the codec, and a codec round-trip carries the new field's value unchanged.
|
||||
- _Requirements: 11.1_
|
||||
- _Boundary: schema + typemap_
|
||||
- [ ] 6.2 Source off-primary committed values + stamp the timestamp in `ctrlstatus_fill`
|
||||
- [x] 6.2 Source off-primary committed values + stamp the timestamp in `ctrlstatus_fill`
|
||||
- TDD (red first, in `test_ctrlstatus.c`): a STANDBY whose learned committed position is non-zero while its local committed marker is zero and it has applied entries reports the LEARNED committed LSN and committed config version (not zero) and the real applied position (no applied-greater-than-committed inversion); a STANDBY that has not yet learned any committed position reports committed LSN and committed config version as zero/unknown; a PRIMARY reports its own authoritative local committed LSN and committed config tag (unchanged); and the responder snapshot timestamp is non-zero and within tolerance of a test-captured wall-clock sample. Assert the handler still mutates no state.
|
||||
- Change `ctrlstatus_fill` (`src/controller/ctrlstatus.c`): role-branch the committed sourcing — when the responder is primary, keep its own committed LSN / committed config tag; otherwise report the learned committed LSN / learned committed config tag. Stamp the responder snapshot timestamp from the wall clock (`CLOCK_REALTIME`, NOT the monotonic clock) at snapshot time. All additions are atomic/aligned loads + a clock read — no state mutation.
|
||||
- Observable: the new unit tests go red → green; the standby case reports the learned non-zero committed value instead of zero; the no-mutation assertion holds.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue