diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-18 10:10:27 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-18 11:03:32 -0300 |
| commit | 30a2426271007992176ad5cd25fb36b77c8b68f2 (patch) | |
| tree | 9cc04b3e8c41bcc3029a058aacf53348a0fe78a6 | |
| parent | 5c5e0102f92938f433a3465c92818be810c1ef78 (diff) | |
| download | pardes-30a2426271007992176ad5cd25fb36b77c8b68f2.tar.gz pardes-30a2426271007992176ad5cd25fb36b77c8b68f2.zip | |
replica: a copy taken ahead (Replica.ready, when the client is idle) is let go once the session's next unit is replayed over it, not held over the session's units and kept in since to replay at a rollback: the soak (test/replicas.zig) never called ready, and calling it after each unit as both clients do when idle (tui.zig, gui.zig) made two of three replicas diverge at once (seed 0 and 1, rtt 30: digest differs in panes, views, views[2].jumps, pane 0.body, pane 1.cwd after another client's mouse release, four texts unequal at quiescence; 0 with one or two clients); every rollback's state checked against the last confirmed unit's digest agreed, so what the held copy put back stale is state no digest covers, not found yet; the soak calls ready now. tty, ReleaseFast, 50,000-line file, client instructions before -> after, own unchanged: key-down 6.37M -> 6.38M (own 3.86M), type 17.25M -> 17.26M, edit 20.36M -> 20.37M, resize 8.26M -> 8.28M, open 68.53M -> 68.57M, page-down 49.28M -> 45.38M, cat 20k 118.3M -> 97.5M (both noisy; load 3-12); replicas pass (3 clients, ready called), core-test 819/958, shell-test 993/996, behaviour-test 273/273 and --replay 20 seeds 0 failures, pane-test 180/181, process-test 2 of 144 (lspcomplete, lspcompletemoved), gui unit-test 1586/1590 (BaselineBuildMismatch), corpus 77/77 (Debug), daemon.py plain, --far, --window-clients
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
| -rw-r--r-- | src/replica.zig | 16 | ||||
| -rw-r--r-- | test/replicas.zig | 1 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/replica.zig b/src/replica.zig index 2a5404c5..a7e6c04e 100644 --- a/src/replica.zig +++ b/src/replica.zig @@ -852,10 +852,12 @@ pub const Replica = struct { const u = parseUnit(msg) orelse return r.fail("a unit too short to read"); r.stats.units += 1; if (u.origin == r.id) if (r.t.core) |c| r.echo.confirmed(c, u.seq); - // A copy taken ahead (`ready`), nothing on top: it stays the point a - // rollback goes back to, the unit replayed on it and kept in `since`, - // not let go and taken again (a megabyte walked) for each unit of - // the session's that comes while the client is idle. + // A copy taken ahead (`ready`), nothing on top: let go once the unit + // is replayed, and taken again when the client is idle. Held over + // the session's units, kept in `since` to replay, it put back a + // state a later step read otherwise than the session's (the soak, + // three clients, with `ready` as the clients call it: diverged; every + // rollback's digest agreed, so what differs is no digest's). const ahead = r.applied == 0 and r.copy.held; if (r.guess) { r.stamp = .{ .real_ns = u.real_ns, .mono_ns = u.mono_ns, .at_ns = nowNs() }; @@ -943,7 +945,11 @@ pub const Replica = struct { r.freePending(r.pending.orderedRemove(0)); } r.dirty = true; - if (ahead) r.keepSince(u.tape); + if (ahead) { + r.copy.release(); + rollback.Epoch.select(null); + r.clearSince(); + } } fn fail(r: *Replica, why: []const u8) void { diff --git a/test/replicas.zig b/test/replicas.zig index 55efd124..ab665bf2 100644 --- a/test/replicas.zig +++ b/test/replicas.zig @@ -421,6 +421,7 @@ fn run(r: Run, dir: []const u8, totals: *Totals) !void { if (m.kind == .to_replica) { rp.confirm(m.bytes); rp.settle(); + rp.ready(); } else if (rp.screen(m.bytes)) |reply| { const pane = m.bytes[0]; if (reply[5] == 1) { |
