Skip to content

fix(scorch): serialize merge task execution - #2

Merged
ajroetker merged 1 commit into
antflydb:antflydb-mainfrom
ajroetker:fix/scorch-serial-merge-tasks
Jul 24, 2026
Merged

fix(scorch): serialize merge task execution#2
ajroetker merged 1 commit into
antflydb:antflydb-mainfrom
ajroetker:fix/scorch-serial-merge-tasks

Conversation

@ajroetker

Copy link
Copy Markdown

Summary

  • execute a merge plan tasks sequentially instead of spawning one goroutine per task
  • bound live transient staging to one merge task output at a time
  • allow cancellation to take effect between tasks

Root cause

The AntflyDB fork parallelized the tasks within a merge plan. Each in-flight task output is correctly considered live and ineligible for garbage collection until the plan is introduced. During deterministic merge retry storms, task concurrency therefore multiplies transient disk staging and the collector cannot safely reclaim it.

Serial execution restores upstream behavior and bounds staging to one task footprint at a time.

Scope

This PR intentionally changes only task execution. It does not change MaxSegmentFileSize, SegmentsPerMergeTask, or any other planner tuning, and it does not add merge logging.

Validation

  • env GOWORK=off go test ./index/scorch/...
  • Scorch and merge-plan packages pass

Related incident: antflydb/antfly#381

Execute merge plan tasks sequentially, matching upstream behavior. Concurrent tasks multiply transient disk staging because every in-flight output remains live and ineligible for garbage collection until the whole plan is introduced.

Serial execution bounds staging to one task at a time and allows cancellation to take effect between tasks. Merge planner size and task-count defaults remain unchanged.
@ajroetker
ajroetker merged commit a723f1c into antflydb:antflydb-main Jul 24, 2026
0 of 10 checks passed
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.

2 participants