Skip to content

fix(6o-i): a capable replica never resumes inside a transaction group (PR 5) - #199

Merged
akosidencio merged 24 commits into
devfrom
fix/v0.6o-i-resync-boundaries
Nov 26, 2026
Merged

akosidencio merged 24 commits into
devfrom
fix/v0.6o-i-resync-boundaries

Conversation

@akosidencio

Copy link
Copy Markdown
Member

Phase 6O-I, PR 5: resynchronization at transaction-group boundaries. Design #195, §7.

Stacked: this branch merges PR 4 (and so #196 and #197). Its own changes are 7db53dc and 055cfba. It stays a draft until those merge. Review D is in round 2: round 1 was APPROVED WITH CHANGES, and its D-1 is fixed in PR 4 and D-2 in PR 3.

Changes

  • Rule 2. resume_frames refuses a partial synchronization to a txn1 replica whose first missing frame is a non-first member of a group. It gives a full sync instead, counted in recached_replication_midgroup_resumes_total, whether or not the group's first frame is still retained. A legacy replica resumes anywhere, as before.

Tests

  • The design's worked example on the hub (§7.3), including a backlog trimmed to the group's tail.
  • A real primary answering resume points before, inside and after a group, with the partial and full sync counters asserted.
  • A replica whose queue overflows on groups: it resumes, converges, and no reader sees part of a transaction.
  • A replica that applied a group, then lost the link before acknowledging it, resumes after it.
  • A middle replica's full sync resets its sub-replicas, which converge.
  • A promoted middle replica still groups for its sub-replica.

…ly (PR 4)

apply_repl_group parses and checks every member first, takes the
replication-order stripes of all of them once, checks the node still
follows, then runs them through KeyValueStore::apply_transaction, the
primary's own 6O-G boundary (inside without_expiry for an expirylog1
stream): one hold of the group's store stripes, marked, from its first
member to its last. Readers of the replica (GET, MGET, EXISTS, TYPE,
STRLEN, a client's borrowed reads) wait for or validate across it and
never see part of a group. The first member that fails stops the rest;
a failure or a panic ends the link with a protocol error (a full sync),
latching persistence unhealthy only when there is an AOF. Then the
effects: this node's AOF takes the group as one group, its sub-replicas
get it with fan_out_group, then notifications and pushes per member.

Design: benchmarks/v0.6.0/6o-i/V0.6O-I-PROTOCOL-DESIGN.md §6.4-§6.5.
… (PR 5)

resume_frames refuses a partial synchronization to a txn1 replica whose
first missing frame is a non-first member of a group (design §7.2 rule 2):
it takes a full synchronization instead, counted in
recached_replication_midgroup_resumes_total, whether or not the group's
first frame is still in the backlog. A legacy replica resumes anywhere, as
before.

Tests: the design's worked example on the hub (with the backlog trimmed to
the group's tail); a real primary's answer to resume points before, inside
and after a group; a slow replica cut off inside a group by its queue
resuming before it while its readers never see part of a transaction; a
replica that applied a group resuming after it; a middle replica's full
sync resetting its sub-replicas; a promoted middle replica grouping for
its sub-replica.
…imary's; a failed group converges every copy

- C H1: a replica announces a group's keys through EXEC's own
  NotificationPlan (notify_replicated_group): each key once, at its last
  change, as its full value when the group changed it more than once, as
  removed_after_set when it was set then removed, FLUSHDB as the primary
  does. Whether a member removed its keys is decided right after it ran,
  inside the hold. Before, each member was announced after the whole group
  with its own delta: a delta live query ended with "abb" for SET a,
  APPEND b.
- C M1 / D D-1: a group that fails or panics part-way resets this node's
  stream (sub-replicas take a full sync from a new run id, also if it is
  promoted first), closes its sync clients to rebuild and tells watchers
  the keyspace changed, as the primary's converge does.
- C L2: the relay takes the group's frames without another copy
  (on_group_logged).
- C L3: why the effects step is not cancellation-safe, and why that is
  acceptable.
- C L1: tests for the delta live query, a WATCH invalidated by set-then-
  remove, a failed group on a middle replica promoted before it reconnects,
  and a failed group with an AOF (latch, prefix kept until the full sync).
…le 2 counted

- D-3: the queue-overflow test is renamed and documented for what it shows
  (a replica whose queue overflows on groups resumes and converges, and its
  readers never see part of a transaction); a link ending inside a group is
  covered deterministically by PR 3's fake-primary test.
- D-5: the real-primary rule-2 test asserts the partial/full sync counters
  for every resume point, not just the mode byte.
@akosidencio
akosidencio marked this pull request as ready for review November 26, 2026 14:03
@akosidencio
akosidencio merged commit 0a1f95e into dev Nov 26, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant