Skip to content

Route the remaining GCS calls through GcsUtilV2 when enabled - #40273

Merged
shunping merged 9 commits into
apache:masterfrom
shunping:gcs-migration-5
Sep 28, 2026
Merged

shunping merged 9 commits into
apache:masterfrom
shunping:gcs-migration-5

Conversation

@shunping

@shunping shunping commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #40244. With use_gcsutil_v2 set, the facade only sent its GcsPath-typed methods to V2. GcsFileSystem and GcpOptions call the String-typed and legacy-model methods, so match, list, copy, rename, delete and bucket creation all stayed on V1.

Changes

  • GcsUtil: when GcsUtilV2 is enabled, every method that predates V2 now goes to V2. That includes getObject(s), listObjects, getBucket, create(path, type[, bufferSize]), copy, rename, remove, and create/removeBucket. Results are converted back to the JSON API model, so callers don't change. V1 behavior is kept:
    • copy and rename overwrite the destination
    • remove ignores a 404
    • buckets get projectPrivate ACLs
  • GcsUtilV2:
    • createBucket takes BucketTargetOption... and an optional project ID.
    • The default upload chunk size now matches gcsio's (8 or 24 MiB, depending on heap size).
    • Three minor gaps with V1 are also fixed:
      • A failure when a write channel is closed (e.g. a failed precondition) is now thrown as an IOException, not an unchecked StorageException.
      • open() on a missing object now records a not_found request metric.
      • bucketAccessible returns false only for a missing bucket or denied access. Other errors (e.g. 5xx) are thrown, so they no longer show up as an inaccessible bucket.
  • ParquetIOLT: use_gcsutil_v2 is now sent to Dataflow jobs. It's joined with the worker experiment, since experiments can only be passed once.

The facade only had V2 branches on its GcsPath-typed methods, but
GcsFileSystem and GcpOptions call the String-typed and legacy-model ones,
so match, list, copy, rename, delete and bucket creation all stayed on V1
even with use_gcsutil_v2 set. Add V2 branches to those, converting Blob
and BucketInfo back to the JSON API model so their callers need no change.

Strategies are picked to match V1: copy and rename rewrite without a
destination precondition, remove ignores a 404, and buckets are created
with projectPrivate ACLs.
The formula is copied rather than read from AsyncWriteChannelOptions
because GcsUtilV2 has no other gcsio reference and the migration ends
with that dependency deleted. The test keeps the two values in sync.
@shunping shunping changed the title Route the remaining GCS calls through GcsUtilV2 Route the remaining GCS calls through GcsUtilV2 when enabled Sep 25, 2026
Route all client access through a @VisibleForTesting storage() accessor.
In GcsUtilTest, merge the V2 helpers into one, test bucketAccessible
through a mocked client, and reset metrics containers in tearDown.
@shunping
shunping marked this pull request as ready for review September 25, 2026 15:13
@shunping

Copy link
Copy Markdown
Collaborator Author

r: @derrickaw

@shunping
shunping requested a review from derrickaw September 25, 2026 15:13
@github-actions

Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@derrickaw derrickaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just one nit on adding reference/comment.

@shunping
shunping merged commit 9497205 into apache:master Sep 28, 2026
23 checks passed
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.

2 participants