Repository navigation
feat: BOOTSTRAP mode for CREATE ASYNC REPLICATION - #59328
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
dd23ea4 to
7107d9a
Compare
2117602 to
a8bd205
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a8bd205 to
eab881a
Compare
|
⚪ ⚪ Details
⚪
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
This comment has been minimized.
This comment has been minimized.
How a replication's destination gets its initial contents was encoded in
INITIAL_SCAN, which says whether a scan happens but not who creates the
destination. Name the choice instead:
BOOTSTRAP = 'SCAN' the controller creates the tables and copies
the rows (INITIAL_SCAN = TRUE)
BOOTSTRAP = 'IMPORT' the controller creates placeholders; the
operator fills them and hands over with
STANDBY (INITIAL_SCAN = FALSE)
BOOTSTRAP = 'SWITCHOVER' the destination tables already exist and
already hold the data, as the old primary's
do after a planned role switchover; the
controller demotes them to read-only replicas
in place and copies nothing
SWITCHOVER is new. The demote was reachable only through a ModifyScheme
with Internal set, which no public API carries, so an operator had to
hand-craft one per table and per synchronous or unique index
implementation table and push it through the legacy
`ydbd db schema exec`.
The controller demotes each destination with the same internal alter it
issues in the opposite direction when a replication reaches DONE, taking
the mode, consistency level and ImportState from the replication's own
configuration so they cannot disagree with it. Index implementation
tables are adopted by their own targets. Unlike other scanless
replications, a switchover one starts in Ready rather than waiting
paused for a hand-over.
INITIAL_SCAN keeps working and is derived from BOOTSTRAP; contradictory
values are an error. SWITCHOVER is refused for a transfer, not accepted
in ALTER, and admitted only from a real cluster administrator, since
demoting a table bypasses every protection a replica table has.
RFC: ydb-platform/ydb-rfc#389
eab881a to
d5caf07
Compare
|
⚪ ⚪
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
✅ Documentation buildRevision built successfully |
Implements ydb-platform/ydb-rfc#389.
Names how a replication's destination gets its initial contents, instead of encoding it in
INITIAL_SCAN:SCANandIMPORTare today'sINITIAL_SCAN = TRUE/FALSE.SWITCHOVERis new: the destination tables already exist as ordinary writable tables holding the data — as the old primary's do after a planned role switchover — and the controller converts them into read-only replicas in place, copying nothing. The demote was previously reachable only through anInternalModifySchemevia the legacy MsgBus service, per table and per index implementation table.The controller demotes each destination with the same internal alter it issues in the opposite direction when a replication reaches
DONE, taking the mode, consistency level andImportStatefrom the replication's own configuration so they cannot disagree with it. Index implementation tables are adopted by their own targets. Unlike other scanless replications, a switchover one starts inReadyrather than waiting paused for a hand-over — that mapping isInitialReplicationState()with its own test, because getting it wrong creates every target and then never starts a worker.INITIAL_SCANkeeps working and is derived fromBOOTSTRAP; contradictory values are an error.SWITCHOVERis refused for a transfer, not accepted inALTER, and admitted only from a real cluster administrator —IsAdministrator()with a non-emptyAdministrationAllowedSIDs, the rule index implementation table alters already use.Note on vocabulary: the mode is named for the scenario, the controller code for the action it performs — the predicate is
IsSwitchover(), while the functions that demote a table in place keepadoptin their names.Tests: 3 parser cases;
DstCreator::SwitchoverAdoptsTableInPlaceandWithoutSwitchoverAPlainTableIsRefused;Replication::InitialStateFollowsInitialScanAndSwitchover. All seven replication controller suites pass. Rehearsed on real cluster pairs: 23 switchover flips, 22 clean (see #59171 for the one failure and what it showed).