fix(localdb): applier review fixes — null-row_json guard, clock recovery via last_seen_hlc, fidelity + guard tests
Claude-Session: https://claude.ai/code/session_01BL2Vu1ESDQ9SCN4gVKkdts
This commit is contained in:
@@ -51,6 +51,8 @@ internal sealed class OplogStore(ILocalDb db, ReplicationOptions options, Func<D
|
||||
"SELECT MAX((SELECT COALESCE(MAX(seq), 0) FROM __localdb_oplog), " +
|
||||
"(SELECT last_acked_seq FROM __localdb_peer_state WHERE id = 1))",
|
||||
static r => r.GetInt64(0), null, ct))[0];
|
||||
// Pruning up to the clamped ack may delete rows the peer never actually received; that is
|
||||
// safe only because needs_snapshot = 1 commits in the SAME transaction, forcing a resync.
|
||||
if (ackedSeq > knownMax)
|
||||
await tx.ExecuteAsync("UPDATE __localdb_peer_state SET needs_snapshot = 1 WHERE id = 1", null, ct);
|
||||
await tx.ExecuteAsync(
|
||||
|
||||
Reference in New Issue
Block a user