Skip to content

Commit

Permalink
backupccl: use rdi.LazyIterator to avoid loading all ranges at once
Browse files Browse the repository at this point in the history
Release note (enterprise change): BACKUPs now load range information as they need it to avoid a spike in metadata lookups when backups begin.
Epic: none.
  • Loading branch information
dt committed Jan 23, 2024
1 parent 293fae4 commit 4bc564f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/ccl/backupccl/backup_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ func runBackupProcessor(
remainingSpan := fullSpan

if rangeSizedSpans {
rdi, err := flowCtx.Cfg.ExecutorConfig.(*sql.ExecutorConfig).RangeDescIteratorFactory.NewIterator(ctx, fullSpan)
const pageSize = 100
rdi, err := flowCtx.Cfg.ExecutorConfig.(*sql.ExecutorConfig).RangeDescIteratorFactory.NewLazyIterator(ctx, fullSpan, pageSize)
if err != nil {
return err
}
Expand All @@ -347,6 +348,9 @@ func runBackupProcessor(
requestSpans = append(requestSpans, spanAndTime{span: subspan, start: start, end: end})
remainingSpan.Key = subspan.EndKey
}
if err := rdi.Error(); err != nil {
return err
}
}

if remainingSpan.Valid() {
Expand Down

0 comments on commit 4bc564f

Please sign in to comment.