backfill method

Future<DVCaptureBackfillProgress> backfill(
  1. DVRecordTable table, {
  2. int chunkSize = 500,
  3. int? maxChunks,
  4. String? tenantColumn,
})

Copies table's live rows to the destination, chunkSize at a time, resuming where an earlier run stopped.

The copy is as of the log's head when it began: the consumer's checkpoint moves there, so the stream resumes after it and every change the copy might have missed still arrives. Rows land as DVCaptureOp.snapshot carrying their record version, so a destination keeps whichever of the copy and the stream is newer. A tenant consumer needs tenantColumn: a row with no tenant on it cannot be shown to belong to that tenant.

A consumer that already has a position within retention is first brought to the head by delivery, so moving its checkpoint skips nothing another model's copy was relying on the stream for.

Implementation

Future<DVCaptureBackfillProgress> backfill(
  DVRecordTable table, {
  int chunkSize = 500,
  int? maxChunks,
  String? tenantColumn,
}) =>
    _serially(() => _backfill(table, chunkSize, maxChunks, tenantColumn));