fix(localdb): FailClosedOnDrift applies to snapshot rows (scadaproj#39)
The drift guard lived only in the delta path; SnapshotApplier applied every row unchecked, so a future-stamped snapshot row was applied, observed by the clock and persisted as last_seen_hlc - moving the receiver's HLC ahead across restarts despite FailClosedOnDrift (LocalDb-004). SnapshotApplier now takes ReplicationOptions and runs the same per-row check (warn once per snapshot; dead-letter under FailClosedOnDrift via the shared HlcDriftGuard, with the row's HLC kept out of last_seen_hlc). Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
@@ -283,7 +283,11 @@ All options are validated at startup (`ZB.MOM.WW.Configuration` validators).
|
||||
- **Clock-drift guard** — warn-once per session when a peer entry's HLC physical time is
|
||||
more than `MaxHlcDriftAhead` ahead. With `FailClosedOnDrift`, each over-drift entry is
|
||||
dead-lettered; otherwise it is applied (the HLC merge absorbs the skew). The **session
|
||||
never dies from drift** — no livelock on reconnect.
|
||||
never dies from drift** — no livelock on reconnect. Since `0.3.6` the guard covers
|
||||
**snapshot rows** too (warn once per snapshot; dead-lettered under `FailClosedOnDrift`, and
|
||||
their HLC is neither observed nor persisted as `last_seen_hlc`). Up to `0.3.5` a snapshot
|
||||
applied every row unchecked, so one future-stamped row could push the receiver's clock
|
||||
ahead permanently.
|
||||
- **Writes never block on the peer**; local commit is independent of replication.
|
||||
- **All timestamps are UTC** (HLC physical component is UTC Unix milliseconds).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user