-
Notifications
You must be signed in to change notification settings - Fork 3k
Flink: Fix NoClassDefFound with Flink runtime jar / Add integration test #6001
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
|
@nastra, can you add some context about what went wrong and why this is the correct solution? |
|
|
||
| // for dropwizard histogram metrics implementation | ||
| implementation "org.apache.flink:flink-metrics-dropwizard:${flinkMajorVersion}" | ||
| implementation "org.apache.flink:flink-metrics-dropwizard:${flinkVersion}" |
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.
thx for fixing this bug
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.
@rdblue I believe this is the main fix. previously, it is using the wrong version number of 1.15. should be the full version of 1.15.0.
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 main fix is actually moving exclude group: 'org.apache.flink' out of the entire implementation configuration so that org.apache.flink:flink-metrics-dropwizard can make it into the runtime jar. Once I did that, I noticed that it's trying to pick up version 1.15 (which doesn't exist) rather than 1.15.0
| dependencies { | ||
| implementation project(":iceberg-flink:iceberg-flink-${flinkMajorVersion}") | ||
| implementation(project(":iceberg-flink:iceberg-flink-${flinkMajorVersion}")) { | ||
| exclude group: 'org.apache.flink' |
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.
@nastra I assume this moved from line 124 above as this is more desired/precise style, right?
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, because otherwise if the exlude is configured for the entire implementation configuration, the org.apache.flink:flink-metrics-dropwizard will never make it into the runtime jar (because it's excluded).
|
|
||
| configurations { | ||
| implementation { | ||
| exclude group: 'org.apache.flink' |
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.
Nice catch.
Can we add a smoke test to Flink runtime jar to catch these kinds of issues?
Spark is already having one here for its runtime jar. https://github.com/apache/iceberg/blob/master/spark/v3.3/spark-runtime/src/integration/java/org/apache/iceberg/spark/SmokeTest.java
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.
good point, I added a smoke test that was failing/hanging without this fix and works with this fix
dadac5e to
d5a1db9
Compare
| inputs.file(shadowJar.archiveFile.get().asFile.path) | ||
| } | ||
| integrationTest.dependsOn shadowJar | ||
| check.dependsOn integrationTest |
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 integration test takes < 20 seconds in total, so it should be ok to run this as part of normal CI when the check task is running
|
@stevenzwu could you re-review the latest changes that add an integration test (similar to the integration testing we do for Spark)? |
|
Thanks @nastra for fixing the problem and adding an smoke test for the runtime module. Thanks @hililiwei and @ajantha-bhat for reviewing. |
#5410 added monitor metrics for Flink and the intention there was to include
org.apache.flink:flink-metrics-dropwizardinto the runtime jar. However, due toexclude group: 'org.apache.flink'for the entireimplementationconfiguration, that dependency never made it into the jar. This can also be seen by looking at the latest Flink Runtime Jar that is being published to the Snapshot repo.When using that runtime jar, things will fail with a
NoClassDefFoundErroras can be seen below:This PR moves the exclude out of the entire
implementationconfiguration and also makes sure that the correct resolvable version (1.15.0 rather than 1.15) oforg.apache.flink:flink-metrics-dropwizardis being selected.@stevenzwu could you review this one please?