You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Backfill of a CDC stream has 3 possible outcomes.
If no history is retained, the backfill behaves no differently than it
would on 7.1. This case can occur because "history_retention_bytes=0"
or the vbucket has explicitly "dropped" any retained history (corner
case of history replication).
If history is retained the backfill can behave in two ways depending on
where the backfill start seqno is relative to
ScanContext::historyStartSeqno.
Case1: start >= ScanContext::historyStartSeqno
The backfill starts inside the retained history range, the backfill
will generate a single DCP snapshot marker followed by the mutations.
The DCP snapshot will state "history" and "may contain duplicates".
Case2: start < ScanContext::historyStartSeqno
The backfill starts below the retained history range. In this case the
disk snapshot is used to generate two DCP snapshots.
The first DCP snapshot is the non-history range, a KVStore::scan from
the requested start upto, but not including
ScanContext::historyStartSeqno.
The second DCP snapshot is the history range, a
KVStore::scanAllVersions from ScanContext::historyStartSeqno to the end
of the disk snapshots sequence index.
In case 2, both DCP snapshot markers represent the entire disk snapshot
That is that they will both state the full disk range and the MVS/HCS
come from the entire range.
For example
The disk seqno index range is from 1 to 20, and this is then split into
two sub-ranges non-history (nh) and history (h)
nh{1,10} h{11, 20}
If a backfill occurs and the requested stream start is any of 0 to 10
DCP will transmit two ranges using two markers as follows:
snapshot marker 1:
snapshot-range{start, 20}
mvs = 20, hcs = 20
flags = disk | checkpoint
mutations start to 10
snapshot marker 2:
snapshot range{start, 20}
mvs = 20, hcs = 20
flags = disk | checkpoint | history | may_contain_duplicates
mutations 11 to 20
The implementation of the "history" range adds a new optional phase to
the DCP backfill state machine. When the backfill transitions into
backfill_state_scanning the variations of the backfill are checked for.
From here the following paths exist.
No history;
backfill_state_scanning -> backfill_state_complete
In this case the full snapshot is delivered from backfill_state_scanning
phase.
Only history:
backfill_state_scanning -> backfill_state_scanning_history_snapshot
In this case the full snapshot is delivered from
backfill_state_scanning_history_snapshot phase. The
The backfill_state_scanning phase has only inspected the ScanContext
and skipped to history.
Two snapshots
backfill_state_scanning -> backfill_state_scanning_history_snapshot
In this case both backfill phases are delivering "snapshots", but the
same magma snapshot is the source.
Change-Id: I5a6df7ed929d99187a74a071c1d523d904cd6f7e
0 commit comments