Skip to content

Parallelize per-file rewrites in GcsUtilV2 copy and move - #40376

Open
shunping wants to merge 1 commit into
apache:masterfrom
shunping:gcs-migration-8
Open

shunping wants to merge 1 commit into
apache:masterfrom
shunping:gcs-migration-8

Conversation

@shunping

@shunping shunping commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

GcsUtilV2.rewriteHelper previously processed files sequentially, making up to three dependent RPCs per file (target lookup, rewrite, and source delete). Unlike V1, which batches rewrites and runs batches concurrently, V2's java-storage client does not support rewrite in StorageBatch, causing rename to be ~6x slower than V1 in 64-shard ParquetIOLT benchmarks.

  • GcsUtilV2: extract per-file logic into rewriteOne and execute multi-file copy/move calls concurrently on a bounded thread pool (up to 32 threads). Propagate the caller's MetricsContainer to worker threads, cancel unstarted tasks on the first failure, and rethrow the original exception type (FileNotFoundException, FileAlreadyExistsException, AccessDeniedException, etc.) with subsequent failures attached as suppressed.
  • GcsUtilV2Test: add testV2RenameRewritesFilesConcurrently and testV2RenameFailuresAreReportedPerFile.

In the 64-shard ParquetIOLT (f1_s1k) write benchmark on Dataflow, V2 gcs_op_rename_msec dropped from ~20.6s to ~1.0s (vs ~2.3s–2.9s on V1) after this change.

@shunping
shunping marked this pull request as ready for review October 1, 2026 14:17
@shunping

shunping commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator Author

cc'ed @chamikaramj @damccorm

This addressed the performance regression of rename op in GcsUtilV2 by parallelizing the rewrites.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@shunping

shunping commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

assign set of reviewers

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @ahmedabu98 for label java.

This pull request likely touches a core component ("core" label). Please review with scrutiny.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@github-actions
github-actions Bot requested a review from ahmedabu98 October 1, 2026 17:11
@shunping
shunping requested review from chamikaramj and removed request for ahmedabu98 October 1, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant