Skip to main content

Module syncup

Module syncup 

Source
Expand description

Replica-feeder syncup: diverged-tail matchpoint search and rollback decision.

Port of the decision core of com.sleepycat.je.rep.stream.ReplicaFeederSyncup (findMatchpoint + verifyRollback) and the protocol exchange documented in FeederReplicaSyncup.java.

When a replica reconnects to a (possibly new) master, the two must agree on the latest COMMON log entry — the matchpoint — defined as the highest VLSN that both nodes hold at the same LSN with a matching log record. If the replica has applied entries after that matchpoint (a diverged tail, e.g. after a failed election), those entries must be ROLLED BACK to the matchpoint before the stream resumes from matchpoint + 1.

This module implements the decision core as pure, testable functions over the VLSN→LSN substrate (the matchpoint search and the verifyRollback truth table). The networked wire exchange (EntryRequest / EntryNotFound / AlternateMatchpoint), the backward ReplicaSyncupReader, and the live replay.rollback log/tree truncation are layered on top by the replica stream driver (see the module-level note in peer_feeder.rs and the REP-1 STEP 5 design note). The rollback EXECUTION reuses the durable recovery machinery built in REP-1 STEPS 1-4 (RollbackStart/End entries, RollbackTracker, TxnChain revert, invisible re-marking).

Structs§

VlsnEntry
One node’s per-VLSN log identity used for matchpoint comparison: the LSN the entry lives at and a record fingerprint (checksum) used to confirm the two nodes hold the same record at that VLSN, not merely the same VLSN.

Enums§

Matchpoint
Outcome of the matchpoint search (ReplicaFeederSyncup.findMatchpoint).
RollbackDecision
The action verifyRollback selects once a matchpoint search has completed.

Traits§

SyncupView
A node’s view of its replicated log for syncup: the VLSN range plus a way to look up each VLSN’s VlsnEntry. Models the replica’s VLSNIndex + log and the feeder’s responses to EntryRequest.

Functions§

find_matchpoint
Search for the highest VLSN that BOTH the replica and the feeder hold with a matching record at the same LSN, scanning the replica’s sync points backward from its lastSync.
verify_rollback
Decide what to do given the matchpoint search result and the replica’s VLSN range, faithful to ReplicaFeederSyncup.verifyRollback’s truth table.