Skip to content

rebase: improve copy objects of one table in parallel by rebase_concurrency - #1650

Merged
Slach merged 3 commits into
masterfrom
rebase_blob_concurrency_1648
Oct 28, 2026
Merged

Slach merged 3 commits into
masterfrom
rebase_blob_concurrency_1648

Conversation

@Slach

@Slach Slach commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Fix #1648

rebase ran every CopyObject inside a table (archives, directory part files, object disk blobs) strictly one by one; general.rebase_concurrency limited only the number of tables in parallel, so one big object disk table was pinned to a single in-flight request.

Changes

  • rebaseTable schedules every CopyObject into a per-table errgroup with SetLimit(rebase_concurrency), so up to rebase_concurrency^2 copies are in flight; no new config knob (rebase is not object disk upload, so object_disk_server_side_copy_concurrency is not reused)
  • part resolution in the required chain, shadow metadata reads and table metadata updates stay serial (rebaseScheduleTableParts), copied sizes are known before the copy starts
  • scheduled copies use the errgroup ctx, not the Walk callback ctx: S3.WalkAbsolute cancels its ctx when Walk returns (caught by TestRebaseS3Directory)
  • a scheduling error cancels pending copies and is reported instead of the resulting context canceled

Tests

  • unit: mock Walk cancels its ctx on return like S3; TestRebaseTableObjectDiskBlobs runs with rebase_concurrency 1 and 4 with a 50ms mock copy delay and asserts the parallel run is faster
  • go test ./..., RUN_TESTS='TestRebase|TestKeepBackupRemoteWithRebase|TestDeleteRequiredBackup' ./test/integration/run.sh — all pass locally

🤖 Generated with Claude Code

Every CopyObject inside a table (archives, directory part files, object
disk blobs) ran strictly one by one, rebase_concurrency limited only the
number of tables, so a single big object disk table was pinned to one
in-flight request and one slow copy stalled the whole table.

rebaseTable now schedules every CopyObject into a per-table errgroup
bounded by rebase_concurrency (up to rebase_concurrency^2 copies in
flight), part resolution and table metadata updates stay serial.
Scheduled copies must not capture the Walk callback ctx: S3.WalkAbsolute
cancels it when Walk returns.

Fix #1648

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coveralls

coveralls commented Oct 28, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 40731052583

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.03%) to 70.521%

Details

  • Coverage increased (+0.03%) from the base build.
  • Patch coverage: 2 uncovered changes across 1 file (101 of 103 lines covered, 98.06%).
  • 28 coverage regressions across 8 files.

Uncovered Changes

File Changed Covered %
pkg/backup/rebase.go 103 101 98.06%

Coverage Regressions

28 previously-covered lines in 8 files lost coverage.

File Lines Losing Coverage Coverage
pkg/backup/delete.go 6 74.79%
pkg/clickhouse/clickhouse.go 6 81.03%
pkg/backup/backuper.go 4 79.23%
pkg/backup/restore.go 4 72.34%
pkg/storage/general.go 3 69.78%
pkg/storage/azblob.go 2 64.29%
pkg/storage/sftp.go 2 59.17%
pkg/status/status.go 1 90.91%

Coverage Stats

Coverage Status
Relevant Lines: 29597
Covered Lines: 20872
Line Coverage: 70.52%
Coverage Strength: 34534.33 hits per line

💛 - Coveralls

@Slach Slach changed the title rebase: copy objects of one table in parallel by rebase_concurrency rebase: improve copy objects of one table in parallel by rebase_concurrency Oct 28, 2026
Without log_level: debug rebase printed nothing between start and the
final "required parts copied", so a long rebase looked hung. Log the
required backups chain, rebase_concurrency and max_copy_object
(rebase_concurrency^2 CopyObject in flight) on start, and
"rebase table start/finish" with progress, duration, copied_size and
object_disk_size per table, same shape as upload/download.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Slach
Slach merged commit 8e0fba0 into master Oct 28, 2026
30 checks passed
@Slach Slach added this to the 2.8.3 milestone Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rebase: CopyObject blob loop is fully serial within a table (rebase_concurrency only bounds tables); add blob-level parallelism

2 participants