Skip to content

Spark 3.3: Relocate all Netty dependencies#6107

Merged
aokolnychyi merged 1 commit intoapache:masterfrom
aokolnychyi:relocate-all-netty
Nov 2, 2022
Merged

Spark 3.3: Relocate all Netty dependencies#6107
aokolnychyi merged 1 commit intoapache:masterfrom
aokolnychyi:relocate-all-netty

Conversation

@aokolnychyi
Copy link
Contributor

@aokolnychyi aokolnychyi commented Nov 2, 2022

This PR contains a change to relocate all Netty dependencies, including netty-common. Prior to this, we relocated only netty-buffer and netty-common libs were packaged in the runtime jar.

Below is the content of the runtime jar before this change.

image

// to make sure io.netty.buffer only comes from project(':iceberg-arrow')
// to make sure netty libs only come from project(':iceberg-arrow')
exclude group: 'io.netty', module: 'netty-buffer'
exclude group: 'io.netty', module: 'netty-common'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We exclude netty-common from many deps but not all. I feel it is safer to be consistent.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about enforce the version instead of excluding here and there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I always consider forcing as the last resort. If we force a version, can it lead to unexpected consequences in libs that would normally pull in another version?

I'd be open to consider forcing but in a separate PR as this one is fixing the relocation in the current approach.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any problem of enforcing in this context. Either works for me, though.

@aokolnychyi
Copy link
Contributor Author

relocate 'org.apache.httpcomponents.client5', 'org.apache.iceberg.shaded.org.apache.httpcomponents.client5'
// relocate Arrow and related deps to shade Iceberg specific version
relocate 'io.netty.buffer', 'org.apache.iceberg.shaded.io.netty.buffer'
relocate 'io.netty', 'org.apache.iceberg.shaded.io.netty'
Copy link
Member

@RussellSpitzer RussellSpitzer Nov 2, 2022

Choose a reason for hiding this comment

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

I think we should be specific about our netty modules we are relocating here. We talked offline and ideally I wish we had an arrow distribution which shaded netty so we wouldn't have to play this game of excluding netty everywhere then adding back in a specific runtime version just to get the shading correctly so that Arrow will have the correct version of netty.

That said for now I think just being explicit will help us in the future to remember what we are doing here 🤞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only problem is that we relocate packages. That's why I'll have to relocate io.netty.util even though it comes from netty-common. If netty-common adds classes under another package, we will miss to relocate them.

I do agree with being more specific in relocation, though.

Copy link
Member

Choose a reason for hiding this comment

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

That's fair. Again I wish we had an arrow distro that just did this for us, but such is life.

Copy link
Contributor Author

@aokolnychyi aokolnychyi Nov 2, 2022

Choose a reason for hiding this comment

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

Ugh, it is really unfortunate.

If I relocate everything under io.netty, it won't be safe if we start pulling netty libs from somewhere. If I relocate io.netty.util, nobody can guarantee a future version of netty-common won't have classes in another package.

Let's probably keep the wildcard relocate as at least we are in control of our deps.

@aokolnychyi aokolnychyi merged commit a0a353d into apache:master Nov 2, 2022
sunchao pushed a commit to sunchao/iceberg that referenced this pull request May 10, 2023
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.

3 participants