feat(ha-wal-replication): standby WAL ACK reply (tasks 3.1-3.3)
Standby sends WalAckReply via xce_reply after each successfully applied WAL entry. ha_apply_wal_catchup_entry signature extended with endpoint_t* and cluster_t* parameters. walackreplymsg union arm added to RequestReply capnp schema and xce_reply_t. Error entries skip ACK. Dispatch gate test confirms OPCode_walCatchupEntry allowed in CTRL_STANDBY/ELECTING/INIT. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
81dbc4d7b4
commit
566c91cd8b
8 changed files with 304 additions and 60 deletions
|
|
@ -50,19 +50,19 @@
|
|||
---
|
||||
|
||||
- [ ] 3. Standby WAL ACK reply
|
||||
- [ ] 3.1 Send WalAckReply after WAL entry applied
|
||||
- [x] 3.1 Send WalAckReply after WAL entry applied
|
||||
- In `ha_apply_wal_catchup_entry` (ha.c), after `ha_apply_single_entry` succeeds for an entry: construct a `WalAckReply { term=ha->term, lsn=ent->lsn, success=1 }` and send via `xce_reply` to the endpoint that delivered the entry.
|
||||
- The endpoint is not directly available in `ha_apply_wal_catchup_entry` — it's called from `cluster.c:handle_wal_catchup_entry` which has the ep. Pass `ep` as a new parameter: `ha_apply_wal_catchup_entry(ha, p, entry, ep)`.
|
||||
- _Requirements: 3.1, 3.2_
|
||||
- _Boundary: Standby dispatch (cluster.c, ha.c)_
|
||||
|
||||
- [ ] 3.2 Skip ACK on apply failure
|
||||
- [x] 3.2 Skip ACK on apply failure
|
||||
- In `ha_apply_single_entry` (ha.c): return distinct error codes for skip-vs-crash.
|
||||
- In `ha_apply_wal_catchup_entry`: if `ha_apply_single_entry` returns non-zero, skip the ACK for that entry (already logged as ERROR).
|
||||
- _Requirements: 3.3_
|
||||
- _Boundary: Standby dispatch (ha.c)_
|
||||
|
||||
- [ ] 3.3 Standby role guard
|
||||
- [x] 3.3 Standby role guard
|
||||
- The existing `ha_dispatch_gate` already allows `OPCode_walCatchupEntry` in `CTRL_STANDBY`, `CTRL_ELECTING`, and `CTRL_INIT`.
|
||||
- Verify with unit test: standby applies WAL entry while in `CTRL_STANDBY`, `CTRL_ELECTING`, `CTRL_INIT` — all succeed.
|
||||
- _Requirements: 3.4_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue