LargeMigrator
B-Large: incremental worker that processes migration queue until empty. Supports pause/resume and progress reporting.
The lifecycle methods (init, fence, drain, complete) are internally consistent but are expected to be driven from a single thread; pause and resume are safe to call from other threads while run() or drain() is in flight.
Attributes
- Source
- LargeMigrator.scala
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Finalize the migration by swapping the shadow table. Requires Drained state (fence() + drain() completed successfully). After complete(), the shadow table becomes the live table and the old table is renamed to {table}_old_{suffix}.
Finalize the migration by swapping the shadow table. Requires Drained state (fence() + drain() completed successfully). After complete(), the shadow table becomes the live table and the old table is renamed to {table}_old_{suffix}.
Attributes
- Source
- LargeMigrator.scala
Drain remaining queue items until pendingCount confirms the queue is truly empty. Uses a separate COUNT query for verification, not just the dequeue result. If batches come back empty while items remain pending for more than MaxEmptyDrainRounds consecutive rounds (e.g. a stuck concurrent worker holding row locks), drain() fails loudly instead of spinning.
Drain remaining queue items until pendingCount confirms the queue is truly empty. Uses a separate COUNT query for verification, not just the dequeue result. If batches come back empty while items remain pending for more than MaxEmptyDrainRounds consecutive rounds (e.g. a stuck concurrent worker holding row locks), drain() fails loudly instead of spinning.
Attributes
- Returns
-
total items processed during drain
- Source
- LargeMigrator.scala
Signal cutover: no more producers will write to the old table. After fence(), drain() will process remaining items and verify emptiness via COUNT query before allowing complete().
Signal cutover: no more producers will write to the old table. After fence(), drain() will process remaining items and verify emptiness via COUNT query before allowing complete().
The application MUST ensure that producers stop writing to the old table before calling fence(). Writes arriving after fence() may be lost or require a separate reconciliation.
Attributes
- Source
- LargeMigrator.scala
Prepare the target table. For ShadowTable strategy, creates the shadow table via TargetStrategyApplier.prepare. When captureTriggers is enabled, installs capture triggers on the source table. Safe to call multiple times (idempotent after first success).
Prepare the target table. For ShadowTable strategy, creates the shadow table via TargetStrategyApplier.prepare. When captureTriggers is enabled, installs capture triggers on the source table. Safe to call multiple times (idempotent after first success).
Attributes
- Source
- LargeMigrator.scala
Whether the migrator is currently paused (checked inside run()).
Whether the migrator is currently paused (checked inside run()).
Attributes
- Source
- LargeMigrator.scala
Pause the migrator loop. In-flight batches complete before exit.
Pause the migrator loop. In-flight batches complete before exit.
Attributes
- Source
- LargeMigrator.scala
Returns queue size estimate (pending items).
Pure preview of init/run SQL without opening any connection.
Pure preview of init/run SQL without opening any connection.
Returns init/run statement texts (queue DDL, shadow create/rename, triggers, dequeue template) rendered against the ambient dialect. Does NOT call Transactor.
Attributes
- Source
- LargeMigrator.scala
Resume processing after a pause.
Runs worker loop until queue is empty or paused. Returns total migrated. Does not auto-complete; caller must use fence/drain/complete protocol for safe cutover.
Runs worker loop until queue is empty or paused. Returns total migrated. Does not auto-complete; caller must use fence/drain/complete protocol for safe cutover.
Attributes
- Source
- LargeMigrator.scala