Skip to content

Add -parallelism to import-finished - #24

Merged
rorylshanks merged 1 commit into
mainfrom
import-finished-parallelism
Nov 16, 2026
Merged

rorylshanks merged 1 commit into
mainfrom
import-finished-parallelism

Conversation

@rorylshanks

Copy link
Copy Markdown
Collaborator

Summary

  • New import-finished -parallelism=N flag (default 1). N workers each claim (MarkImporting) and download/extract an artifact concurrently.
  • Moving parts into detached/ and ATTACH PART stay serialized behind a mutex. Ownership is set on the extracted parts before taking the lock to keep it short.
  • On an artifact failure, in-flight sibling downloads are cancelled and released back to FINISHED; only the failing artifact is marked FAILED, and only its error is returned.
  • A sibling failure never interrupts an attach that already holds the lock. Workers that were waiting for the lock when a sibling failed skip the attach and release. External cancellation (SIGINT) behaves as before.
  • ImportJob.Parallelism < 1 is rejected.

Notes

  • Each download is its own s5cmd process with its default worker count, so S3 connections scale with N.
  • The work-dir needs room for N extracted artifacts at once (documented in docs/setup.md).

Testing

  • New unit tests: overlapping downloads with serialized attaches (max 1 concurrent ATTACH), sibling release on failure, zero-parallelism rejection. Passes with -race -count=5.
  • e2e main import now runs with -parallelism=4.
  • go mod tidy (clean), go test ./..., ./e2e/run.sh all pass.

🤖 Generated with Claude Code

import-finished claimed, downloaded, and attached one artifact at a
time, so wall time was dominated by serial S3 downloads. -parallelism=N
runs N workers that each claim and download an artifact concurrently;
the move into detached/ and ATTACH PART stay serialized behind a mutex.

On an artifact failure, in-flight sibling downloads are cancelled and
released back to FINISHED; only the failing artifact is marked FAILED.
A sibling failure never interrupts an attach that already holds the
lock, so partial attaches are only possible on external cancellation,
as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rorylshanks
rorylshanks merged commit c8f1dda into main Nov 16, 2026
11 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.

1 participant