forked from lei.chen/myxce
feat(ha-entity-snapshots): consume restoration indicator in the catch-up receive handler (task 6.1)
ha_handle_snapshot_chunk now logs whether a received checkpoint was fully entity-restored or was a legacy position-only file (INFO level, framed as an expected rollout state -- never an error, per design.md). The rc-gates-applied_lsn control flow is byte-for-byte unchanged from task 5.2 (confirmed by review) -- this task is purely additive observability, matching design.md's own note that this call site "needs no change" once persist_load_snapshot's gate is correct. New test drives the legacy path end-to-end through the real production handler (rc==0, file renamed, applied_lsn advances to the legacy LSN). This completes the integration layer -- write path (jobs+queues), restore-before-advance read path, and the production wiring are all in place and independently reviewed. Only validation tasks remain (7.1 chaotic soak, 8.1 rollback compatibility). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JDYFbrgyDHbvNYcxApKhrX
This commit is contained in:
parent
9fdb6778d4
commit
cc31a009ed
3 changed files with 99 additions and 7 deletions
|
|
@ -2594,9 +2594,10 @@ int ha_handle_snapshot_chunk(ha_state_t *ha, persist_t *p,
|
|||
}
|
||||
|
||||
/* Load the snapshot — sets p->checkpoint_lsn and p->current_lsn.
|
||||
* ha-entity-snapshots task 5.1: call-site signature compat only for the
|
||||
* new out-param — entities_restored itself is not yet consumed here
|
||||
* (that is task 6.1's job, once 5.2 makes the flag meaningful). */
|
||||
* ha-entity-snapshots task 6.1: entities_restored is consumed below,
|
||||
* purely for observability — it does not change the rc-gates-applied_lsn
|
||||
* ordering here (persist_load_snapshot/load_snapshot already gate their
|
||||
* own position advance on entity-restore success, task 5.2). */
|
||||
bool entities_restored = false;
|
||||
int rc = persist_load_snapshot(p, final_path, chunk->snapshot_lsn,
|
||||
&entities_restored);
|
||||
|
|
@ -2608,8 +2609,19 @@ int ha_handle_snapshot_chunk(ha_state_t *ha, persist_t *p,
|
|||
/* Advance applied_lsn to checkpoint_lsn (in-memory only — Req 4.2) */
|
||||
atomic_store_explicit(&ha->applied_lsn, p->checkpoint_lsn,
|
||||
memory_order_release);
|
||||
INFO("HA: snapshot loaded lsn=%" PRIu64 " applied_lsn set",
|
||||
p->checkpoint_lsn);
|
||||
|
||||
/* Observability only (Requirements 2.4, 4.1, 4.2, 5.1, 5.2) — a legacy
|
||||
* (position-only) checkpoint is an expected rollout state, not an error:
|
||||
* log it as informational and let the member continue through the
|
||||
* existing incremental catch-up path for the remaining history. */
|
||||
if (entities_restored) {
|
||||
INFO("HA: snapshot loaded lsn=%" PRIu64 " with full job/queue entity "
|
||||
"restoration — applied_lsn set", p->checkpoint_lsn);
|
||||
} else {
|
||||
INFO("HA: snapshot lsn=%" PRIu64 " is a legacy position-only "
|
||||
"checkpoint (no entity content) — applied_lsn set, continuing "
|
||||
"via normal incremental catch-up", p->checkpoint_lsn);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue