Seeding a replica: a fresh link starts from a snapshot
DEFINE REPLICATION … SEED AT declares a link at a snapshot's end: the row lives SEEDING → STANDBY → ACTIVE, promotes itself on catch-up, and ALTER REPLICATION … ACTIVE is the early-promote spelling, refusing while the copy runs behind. Both directions rehearsed on live clusters; the numbers the seed is named from are the ones INFO FOR DATABASE reports.
A replication link that starts from nothing must copy the database's whole
history before the tail it will follow. Seeding is the explicit spelling of
that start: the link is declared at a snapshot's end, catches the log tail up
from there, and only then serves. From 0.50.0 the lifecycle is on the link
row, both halves of it rehearsed on live two-cluster setups, forward and
reverse.
The procedure
-- at the source, after the database has lived a while:
tessaridb <store> --backup prod.shop.snapshot
-- the snapshot restores into the new cluster's store, and the link is
-- declared AT THE POSITION THE SNAPSHOT ENDS AT — the tail the report names:
INFO FOR DATABASE; -- the log group's start and tail, read from the copy
DEFINE REPLICATION east TO 'dr.internal:9080' FOR DATABASE prod.shop SEED AT 5;
SEED AT names the position the snapshot ended at. On the source's side the
link is born seeding — it serves the log tail from there; on the
restored copy's side the same seed, named from the tail INFO FOR DATABASE
reports on the copy, is born standby when the copy's tail already reaches
the floor. The first shipment past the floor promotes the source at the serve;
the copy promotes itself when the applied position reaches the seed and the
lag closes. ALTER REPLICATION … ACTIVE is the early-promote spelling for an
operator who does not want to wait — it refuses while the copy runs behind,
naming the lag, and it is a no-op on an already-active link.
PAUSED stays orthogonal the way it always was: a seeded link holds and
resumes with the same statement as any other.
The numbers are the ones the report names
INFO FOR DATABASE answers the log the machinery answers by — its start
and tail, the two numbers the seed procedure is written from, so the seed
is named from what the store itself reports rather than a figure an operator
has to measure some other way. INFO FOR REPLICATION answers the progress
beside the link: state, seed_at, applied, source_latest and lag —
each a fact the side holding it can vouch for, null where the side cannot
know it yet.
One log per seed
A position counts in one log, and a seeded link names, serves and is measured by the log its seed names — the same rule the report names seeds from. This matters the moment a survivor becomes a source: a node that lost its peer and kept serving holds two logs of the database, the received one and its own. The survivor's received log never serves — the far side's snapshot already holds every effect it carries, and shipping it again would re-send state the far side cannot apply below its snapshot-restored start, a wedge no catch-up fixes. The survivor reseeds the lost primary over its own log: it backs up, the primary's store is wiped and restored, both halves declare at the tail the survivor's report names, and the reversed pair carries writes. Rehearsed live, both directions, with the states asserted at each transition.
Honest halves
The seed's two halves refuse rather than overclaim. A snapshot file cut
mid-record is refused at the restore, not landed as a copy the seed would
overclaim. A log tail offered from below the seed's floor is refused at the
intake (TailBelowSeed); a seed position pruned below the log's start is
refused by name (BelowLogStart). At-least-once application was already the
link's contract — the seed rides it, and a record applied twice applies as
once.