Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-8889] Upgrade GCSIO to 2.2.2 #14817

Merged
merged 3 commits into from
Jul 11, 2021
Merged

Conversation

veblush
Copy link
Contributor

@veblush veblush commented May 14, 2021

This is for upgrading GCSIO to 2.2.2

R: @kennknowles

Changes:

  • Addressed breaking changes:
    • Removed ResilientOperation.getGoogleRequestCallable.
    • Applied CreateObjectOptions build pattern.
    • Applied new StorageResourceId type.
  • Code clean-up:
    • Applied builder pattern for AsyncWriteChannelOptions and GoogleCloudStorageOptions.
    • Updated missing types in the comment (AbstractGoogleAsyncWriteChannel)
  • Passing the Credentials to GoogleCloudStorageOptions so that it can use DirectPath properly with GCSIO 2.2.2 or later.

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

ValidatesRunner compliance status (on master branch)

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- Build Status Build Status --- Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status
Build Status
Build Status
Build Status
Python --- Build Status
Build Status
Build Status
Build Status
Build Status
--- Build Status ---
XLang Build Status Build Status Build Status --- Build Status ---

Examples testing status on various runners

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- --- --- --- --- --- ---
Java --- Build Status
Build Status
Build Status
--- --- --- --- ---
Python --- --- --- --- --- --- ---
XLang --- --- --- --- --- --- ---

Post-Commit SDK/Transform Integration Tests Status (on master branch)

Go Java Python
Build Status Build Status Build Status
Build Status
Build Status

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status Build Status --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@veblush
Copy link
Contributor Author

veblush commented May 14, 2021

@mprashanthsagar Could you take a look at the changes to address breaking changes from GCSIO 2.2.x?

@veblush
Copy link
Contributor Author

veblush commented May 15, 2021

This is tested with the bleeding edge version of GCSIO with the following instruction. It's verified that Beam job uses Directpath for the GCS operations with the lastest version of GCSIO.

Build GCSIO (2.2.1-SNAPSHOT)

$ ./mvnw -P hadoop2 clean install -DskipTests

Build Beam (After modifying the version of gcsio to 2.2.1-SNAPSHOT)

$ ./gradlew -Ppublishing -PjavaLinkageArtifactIds=beam-sdks-java-io-google-cloud-platform --continue :checkJavaLinkage

Build word-count example (After modifying the version of beam to 2.29.0-SNAPSHOT)

$ mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.WordCount \
  -Dexec.args="--runner=DataflowRunner --project=$PROJECT \
  --region=$REGION \
  --gcpTempLocation=gs://$BUCKET/tmp \
  --inputFile=gs://$BUCKET/shakespeare/* \
  --output=gs://$BUCKET/counts \
  --subnetwork=$SUBNET_PATH \
  --experiments=use_grpc_for_gcs \
  " -Pdataflow-runner

@aaltay
Copy link
Member

aaltay commented May 27, 2021

What is the next step on this PR? Do you need a review or wait until the new GCSIO changes are merged.

@veblush
Copy link
Contributor Author

veblush commented May 28, 2021

@aaltay This is still a draft and it needs to wait for the next GCSIO release. Once it's released, this PR will be ready to get reviewed.

@veblush veblush changed the title Upgrade GCSIO to 2.2.x [BEAM-8889] Upgrade GCSIO to 2.2.2 Jun 30, 2021
@veblush veblush marked this pull request as ready for review June 30, 2021 21:25
@@ -763,7 +751,7 @@ public void onSuccess(StorageObject response, HttpHeaders httpHeaders)
@Override
public void onFailure(GoogleJsonError e, HttpHeaders httpHeaders) throws IOException {
IOException ioException;
if (errorExtractor.itemNotFound(e)) {
if (e.getCode() == HttpStatusCodes.STATUS_CODE_NOT_FOUND) {

Choose a reason for hiding this comment

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

itemNotFound(e) does a recursive check to find the exception, we could have a STATUS_CODE_NOT_FOUND in the cause but not the root exception, Can we retain usage of errorExtractor.itemNotFound() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not possible anymore because ApiErrorExtrator doesn't support GoogleJsonError anymore by GoogleCloudDataproc/hadoop-connectors#327. I copied the same routine from the old ApiErrorExtrator to do the same thing.

Copy link
Contributor

Choose a reason for hiding this comment

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

So this is a regression ? Note that Beam file IO connectors are very sensitives to changes in behavior of rename/copy/delete etc. since current behavior is carefully implemented (after many bugs) to be correct when there are step failures and retries.

Copy link
Contributor

Choose a reason for hiding this comment

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

(unresloving)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, itemNotFound method was removed by the recent gcsio so I copied the actual implementation of the method to keep it consistent.

@chamikaramj chamikaramj self-requested a review July 2, 2021 17:51
Copy link
Contributor

@chamikaramj chamikaramj left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -107,6 +110,7 @@ public GcsUtil create(PipelineOptions options) {
storageBuilder.getHttpRequestInitializer(),
gcsOptions.getExecutorService(),
hasExperiment(options, "use_grpc_for_gcs"),
gcsOptions.getGcpCredential(),
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not backwards compatible. What if gcpCredentials is not provided ? (I assume default credentials will be used but we should make sure that this does not result in a regression).

* @return a SeekableByteChannel that can read the object data
*/
@VisibleForTesting
SeekableByteChannel open(GcsPath path, GoogleCloudStorageReadOptions readOptions)
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is this used ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is used for the test. Previously test access the implementation detail (e.g. GoogleCloudStorageReadChannel) in testGCSChannelCloseIdempotent() but it doesn't need to do it anymore with this function.

@@ -763,7 +751,7 @@ public void onSuccess(StorageObject response, HttpHeaders httpHeaders)
@Override
public void onFailure(GoogleJsonError e, HttpHeaders httpHeaders) throws IOException {
IOException ioException;
if (errorExtractor.itemNotFound(e)) {
if (e.getCode() == HttpStatusCodes.STATUS_CODE_NOT_FOUND) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So this is a regression ? Note that Beam file IO connectors are very sensitives to changes in behavior of rename/copy/delete etc. since current behavior is carefully implemented (after many bugs) to be correct when there are step failures and retries.

@chamikaramj
Copy link
Contributor

Retest this please

@chamikaramj
Copy link
Contributor

Run Java PostCommit

@chamikaramj
Copy link
Contributor

Run Dataflow ValidatesRunner

@veblush veblush requested a review from chamikaramj July 7, 2021 23:31
@codecov
Copy link

codecov bot commented Jul 7, 2021

Codecov Report

Merging #14817 (b6e2281) into master (7b30339) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #14817   +/-   ##
=======================================
  Coverage   83.78%   83.78%           
=======================================
  Files         441      441           
  Lines       59500    59500           
=======================================
+ Hits        49852    49855    +3     
+ Misses       9648     9645    -3     
Impacted Files Coverage Δ
.../python/apache_beam/testing/test_stream_service.py 88.37% <0.00%> (-4.66%) ⬇️
...che_beam/runners/interactive/interactive_runner.py 90.65% <0.00%> (-1.87%) ⬇️
...ython/apache_beam/examples/kafkataxi/kafka_taxi.py 0.00% <0.00%> (ø)
...hon/apache_beam/runners/direct/test_stream_impl.py 94.02% <0.00%> (ø)
...ks/python/apache_beam/runners/worker/sdk_worker.py 89.00% <0.00%> (+0.15%) ⬆️
sdks/python/apache_beam/io/range_trackers.py 94.33% <0.00%> (+0.19%) ⬆️
...hon/apache_beam/runners/worker/bundle_processor.py 93.85% <0.00%> (+0.37%) ⬆️
sdks/python/apache_beam/io/fileio.py 95.89% <0.00%> (+0.42%) ⬆️
sdks/python/apache_beam/io/kafka.py 80.00% <0.00%> (+0.83%) ⬆️
sdks/python/apache_beam/internal/metrics/metric.py 87.23% <0.00%> (+1.06%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b30339...b6e2281. Read the comment docs.

@chamikaramj
Copy link
Contributor

Run PythonDocker PreCommit

@chamikaramj
Copy link
Contributor

Run Java_Examples_Dataflow PreCommit

@chamikaramj
Copy link
Contributor

Thanks. LGTM

(please make sure that all internal tests pass as well)

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.

4 participants