-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[ FLINK-33603][FileSystems] shade guava in gs-fs filesystem #23489
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @singhravidutt . Thank you for the patch. This looks right to me, but I see there was a build failure in CI. Can you please investigate?
@flinkbot run azure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 (non-binding)
Thanks for the fix, @singhravidutt . I'm not sure if flinkbot really gave it another run though?
@cnauroth flink bot does not add every run into the CI report list, so it probably did. The issue is with the licenses/NOTICE file: See https://cwiki.apache.org/confluence/display/FLINK/Licensing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@singhravidutt I see that the ticket you reference in the title has already been closed.
https://issues.apache.org/jira/browse/FLINK-31631
Please create a new issue in Flink JIRA describing the reason for the current change.
@flinkbot run azure |
Any progress on this? We need it for upgrading our jobs to 1.18 :) |
Created FLINK-33603 for this issue. @singhravidutt - can you please update the JIRA request number |
@flinkbot run azure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is failing due to licensing checks (missing entries in the correct NOTICE file). Let me see if I can help you out
<filters> | ||
<filter> | ||
<artifact>org.apache.flink:flink-fs-hadoop-shaded</artifact> | ||
<excludes> | ||
<exclude>com/google/common/**</exclude> | ||
<exclude>org/checkerframework/**</exclude> | ||
<exclude>com/google/errorprone/**</exclude> | ||
<exclude>com/google/j2objc/**</exclude> | ||
<exclude>com/google/thirdparty/publicsuffix/**</exclude> | ||
</excludes> | ||
</filter> | ||
<filter> | ||
<artifact>*</artifact> | ||
<excludes> | ||
<exclude>properties.dtd</exclude> | ||
<exclude>PropertyList-1.0.dtd</exclude> | ||
<exclude>mozilla/**</exclude> | ||
<exclude>META-INF/maven/**</exclude> | ||
<exclude>META-INF/NOTICE.txt</exclude> | ||
<exclude>META-INF/LICENSE.txt</exclude> | ||
</excludes> | ||
</filter> | ||
</filters> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't exclude these dependencies during shading, but exclude them from when we're adding the dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flink-fs-hadoop-shaded
is a shaded jar which doesn't relocate the classes mention in the exclusion rules here. The only way I see we can exclude them is by mentioning them explicitly here.
<!-- shade google guava version--> | ||
<relocation> | ||
<pattern>com.google.common</pattern> | ||
<shadedPattern>org.apache.flink.fs.gs.com.google.common</shadedPattern> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wouldn't work, right? Because I'm assuming GCS is looking for com.google.common
and not org.apache.flink.fs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With shading it would rewrite the import:com.google.common
in classes of module:flink-gs-fs-hadoop
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but the code from GCS still expects the import to be com.google.common
because it doesn't know about the shaded class.
I'm still kind of puzzled. If this is required by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@singhravidutt I think the key part lies here:
This is where Guava gets excluded; that doesn't work for GCS. I think that's the fix for this problem :)
If I remove this exclusion and run a mvn dependency:tree
, I see
[INFO] +- com.google.cloud:google-cloud-storage:jar:2.29.1:compile
[INFO] | +- com.google.guava:guava:jar:32.1.2-jre:compile
The only other reference to Guava for this module is:
[INFO] +- org.apache.flink:flink-core:jar:1.19-SNAPSHOT:provided
[INFO] | \- org.apache.flink:flink-shaded-guava:jar:31.1-jre-17.0:provided
Which I don't think should be a problem (it's
@singhravidutt I've created 2ebe7f6 to test it out on private CI. Let me know what you think |
@singhravidutt Can I get your thoughts on #23920 as an alternative solution? |
<filters> | ||
<filter> | ||
<artifact>org.apache.flink:flink-fs-hadoop-shaded</artifact> | ||
<excludes> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, we don't need to exclude shaded guava classes since it will not disturb if a right guava version dependency is in the classpath.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[WARNING] flink-fs-hadoop-shaded-1.19-SNAPSHOT.jar, guava-32.1.2-jre.jar define 1837 overlapping classes:
[WARNING] - com.google.common.annotations.Beta
[WARNING] - com.google.common.annotations.GwtCompatible
[WARNING] - com.google.common.annotations.GwtIncompatible
[WARNING] - com.google.common.annotations.VisibleForTesting
[WARNING] - com.google.common.base.Absent
[WARNING] - com.google.common.base.AbstractIterator
[WARNING] - com.google.common.base.AbstractIterator$1
[WARNING] - com.google.common.base.AbstractIterator$State
[WARNING] - com.google.common.base.Ascii
[WARNING] - com.google.common.base.CaseFormat
[WARNING] - 1827 more...
I see this while building the package. My interpretation if it is that because flink-fs-hadoop-shaded
is shaded jar AND it's not relocating guava classes. Shaded jar contains classes of guava. Hence just excluding guava as transitive dependency from module:flink-fs-hadoop-shaded
is not enough.
flink-gs-fs-hadoop
will contain two implementation of guava classes i.e. com.google.common.*
one coming from flink-fs-hadoop-shaded
which will be from guava version v27.1
and other from guava v32.1.2
. As fun:buildOrThrow
is not available in with v27.
is causes runtime failure.
Hence we have to either repackage every dependency of flink-fs-hadoop-shaded
and then add as a dependency or exclude the jars manually.
What are your thoughts on that?
Hi folks, thanks for driving it. @MartijnVisser I am not sure if your version will work, since there is still a @singhravidutt: #23920 from @MartijnVisser actually shows the right direction. We don't need to exclude guava in I would suggest a solution combine both of your thoughts plus a small suggestion from me:
Please correct me if I am wrong. Look forward to your thoughts. |
@flinkbot run azure |
@flinkbot run azure |
@JingGe Thanks for the comments. I've been looking at different options to shade the artifacts, and also try that with a local application that writes to GCS. Unfortunately, I haven't gotten that to work yet :( |
@JingGe @singhravidutt I think I've cracked it :)
I'm currently testing if my patch would also work when backported to 1.18. |
@snuyanzin I'm also looping you in here
Newsflash: I didn't work 😭 Which in hindsight, is quite obvious: Let me do some more tests and I'll get back here |
There are two possibilities to solve this:
Both of these approaches make checkpointing work again, I've validated that locally. In @JingGe @singhravidutt @snuyanzin Any preference? I'm leaning towards 1, since that would be the same solution for both 1.18 and 1.19, with option 2 being a specific fix for 1.18 only. |
Licensing issue is fixed in the latest commit but I still feel we should exclude guava specific jars coming from |
Superseded by https://issues.apache.org/jira/browse/FLINK-33704 - Thanks for the help/thinking on this @singhravidutt @singhravidutt @cnauroth Do you have any bandwidth to add a GCS connector test to Flink? |
Hello @MartijnVisser , it's been a while, but I just sent in some new integration tests at #26102 . |
What is the purpose of the change
Shade the guava version required specifically by google-cloud-storage.
Brief change log
Introduced dependency on guava version(
31.1-jre
) required bygoogle-cloud-storage
. Upgrade ofgoogle-cloud-storage
lead to runtime failure because of new functionalities added in31.1-jre
.This change pins guava version to the one required by storage client specifically in
flink-gs-fs-hadoop
, leaving all other filesystem implementation untouched.Verifying this change
This change is already covered by existing tests. These tests pass with the new version.
Created a cluster by replacing binaries specific to
flink-gs-fs-hadoop
and ran the following jobEarlier it was failing with following error
Execution for the same job successful now with these changes.
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: noDocumentation