feat(ha-entity-snapshots): entity-bearing checkpoint write path for queues (task 3.2)
write_snapshot replaces the queue_count=0 placeholder with a real collect_queue_frames helper: enumerates every queue in the live table under nested table+per-entity RTTI_LOCK_READ (no retention filter -- table presence already implies config-provisioned existence, unlike jobs), writes each queue's (name, status) as a plain fixed record (no capnp -- matches restore_queue_state's exact contract). Any failure anywhere still discards the whole checkpoint, including any already-collected job frames, no partial file at the final path. Entirely contained to persist.c -- load_snapshot and persist.h remain byte-identical to before this task, honoring the boundary lesson task 2.2 established (queue restoration stays task 5.2's scope). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JDYFbrgyDHbvNYcxApKhrX
This commit is contained in:
parent
86b12b8323
commit
eac7bb8ad8
2 changed files with 146 additions and 11 deletions
|
|
@ -31,7 +31,7 @@
|
|||
- _Requirements: 1.1, 1.2, 1.3, 1.4_
|
||||
- _Boundary: Persistence Layer (write_snapshot)_
|
||||
|
||||
- [ ] 3. Core: entity-bearing checkpoint write path — queues
|
||||
- [x] 3. Core: entity-bearing checkpoint write path — queues
|
||||
- [x] 3.1 RED: queue admin-status round-trip test
|
||||
- Assert a queue's (name, status) pair written into the checkpoint and read back matches
|
||||
exactly
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
- _Requirements: 1.1_
|
||||
- _Boundary: Persistence Layer (write_snapshot)_
|
||||
- _Depends: 2.2_
|
||||
- [ ] 3.2 Collect queue admin-status into the checkpoint
|
||||
- [x] 3.2 Collect queue admin-status into the checkpoint
|
||||
- Enumerate every queue present in the live table (its table presence already implies
|
||||
config-provisioned existence), take each queue's own read lock nested inside the table walk,
|
||||
append its name+status as a plain record (no serialization schema needed — matches the
|
||||
|
|
@ -130,3 +130,4 @@
|
|||
- (2.2) `restore_job` (job.c) decodes via `decode_Job` → `decode_JobSubmitData_ptr`/`decode_JobStartInfo_ptr` (STRING_DUP'd fields) into a local `xce_job_t j`; that decoded struct is never released via `free_Job(&j)` after `create_job` takes its own copy — a real, pre-existing leak on `restore_job`'s decode path. Not touched by task 2.2 (its `load_snapshot` excursion was fully reverted, see next note) — task 5.2 will reintroduce this call site and must fix the leak there.
|
||||
- (2.2) First attempt ALSO touched `load_snapshot`/`persist.h` to make task 2.1's round-trip tests pass end-to-end, but review found it advanced `current_lsn`/`checkpoint_lsn` BEFORE the entity-decode loop ran -- a live silent-divergence hazard reachable through the unmodified `ha_handle_snapshot_chunk` production path (reachable today, not hypothetical, since `write_snapshot` now always emits entity-bearing checkpoints). REMEDIATED by fully reverting `load_snapshot`/`persist.h` to pre-2.2 state (byte-identical to commit `0f344da`) and rewriting the round-trip tests to parse `write_snapshot`'s raw on-disk bytes directly (new `snapent_read_checkpoint_jobs` helper using `read_Job`/`decode_Job`) instead of round-tripping through `persist_load_snapshot`. Task 5.2 must implement `load_snapshot`'s entity-decode from scratch per design.md's restore-before-advance-position contract -- do not assume any decode scaffolding exists yet.
|
||||
- (3.1) `snapent_read_checkpoint_queues`'s job-section skip loop duplicates `snapent_read_checkpoint_jobs`'s (task 2.2) skip logic verbatim rather than sharing a helper -- minor, non-blocking; consider factoring a shared "skip past job section" reader if task 5.x's test coverage grows the file further.
|
||||
- (3.2) Pre-existing ASan leak in the test fixture itself (`snapent_make` -> `makeInstance`/`makeJob`/`makeQueue`/`xkvmgr_add`, ~18KB/113 allocations), unrelated to any production code -- present since task 1.1, masked by the project's standing `ASAN_OPTIONS=detect_leaks=0` convention for this suite. Not blocking any task; worth a dedicated fixture-teardown cleanup pass if this test file keeps growing.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue