Skip to content

[build] Relocate shaded jackson and other internal deps in fluss-fs-s3 - #4073

Open
Jackeyzhe wants to merge 1 commit into
apache:mainfrom
Jackeyzhe:fix-fs-s3-jackson-relocation
Open

[build] Relocate shaded jackson and other internal deps in fluss-fs-s3#4073
Jackeyzhe wants to merge 1 commit into
apache:mainfrom
Jackeyzhe:fix-fs-s3-jackson-relocation

Conversation

@Jackeyzhe

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close #4072

The fluss-fs-s3 uber-jar bundles hadoop-common and aws-java-sdk-*
dependencies without any shade relocations, leaking 1,114 unshaded
jackson class files (jackson-databind, jackson-core,
jackson-annotations, jackson-dataformat-cbor) at com/fasterxml/*
paths. These can shadow a downstream application's own jackson-core
(e.g. 2.16+) and cause runtime failures such as NoSuchMethodError.

Brief change log

fluss-filesystems/fluss-fs-s3/pom.xml:

  • Added shade relocations for the transitively-bundled third-party
    packages, namespaced under org.apache.fluss.fs.shaded.s3.*
    (mirroring the pattern already used by fluss-fs-hadoop-shaded):
    • com.fasterxmlorg.apache.fluss.fs.shaded.s3.com.fasterxml
    • org.codehausorg.apache.fluss.fs.shaded.s3.org.codehaus
    • com.ctcorg.apache.fluss.fs.shaded.s3.com.ctc
    • com.google.re2jorg.apache.fluss.fs.shaded.s3.com.google.re2j
    • org.apache.htraceorg.apache.fluss.fs.shaded.s3.org.apache.htrace
  • Added a <filter> excluding META-INF/versions/**/com/fasterxml/**:
    the Maven Shade Plugin relocates base-path classes but not
    Multi-Release JAR entries (same issue class as [fluss-client][ fluss-flink-*] Uber-jars leak com.fasterxml.jackson.core alongside the shaded copy #3553, which affected
    fluss-shaded-jackson). The relocated base-path implementation is
    sufficient for all Java versions.

Tests

Build-only change (pom.xml), verified by inspecting the produced jar:

  • Before fix: unzip -l fluss-fs-s3-*.jar | grep -c " com/fasterxml"
    → 1,114 unshaded entries
  • After fix: 0 unshaded com/fasterxml entries (base path and MRJ);
    1,093 jackson classes correctly relocated to
    org/apache/fluss/fs/shaded/s3/com/fasterxml/*
  • Bytecode references inside the bundled AWS SDK / Hadoop classes are
    rewritten to the shaded path (verified via javap on sampled classes)
  • Intentional jaxb-api MRJ entries under META-INF/versions/** are
    preserved untouched
  • ./mvnw spotless:check passes

API and Format

No API or storage format changes. This only affects the internal shading
layout of the fluss-fs-s3 uber-jar; all relocated classes move under
the org.apache.fluss.fs.shaded.s3 namespace.

Documentation

No new feature introduced; no documentation changes required.

The fluss-fs-s3 uber-jar bundles hadoop-common and aws-java-sdk
dependencies without any shade relocations, leaking 1,114 unshaded
jackson class files (jackson-databind, jackson-core, jackson-annotations,
jackson-dataformat-cbor) at com/fasterxml/* paths. This can shadow
downstream applications' jackson-core and cause NoSuchMethodError at
runtime.

Fix by adding the same relocation pattern used by fluss-fs-hadoop-shaded:
- com.fasterxml -> org.apache.fluss.fs.shaded.s3.com.fasterxml
- org.codehaus -> org.apache.fluss.fs.shaded.s3.org.codehaus
- com.ctc -> org.apache.fluss.fs.shaded.s3.com.ctc
- com.google.re2j -> org.apache.fluss.fs.shaded.s3.com.google.re2j
- org.apache.htrace -> org.apache.fluss.fs.shaded.s3.org.apache.htrace

Also excludes META-INF/versions/**/com/fasterxml/** because the shade
plugin relocates base-path classes but not Multi-Release JAR entries
(same issue class as apache#3553).

Verified: 0 unshaded com/fasterxml entries (base path and MRJ),
1,093 jackson classes correctly relocated, bytecode references in
AWS SDK/Hadoop classes rewritten to the shaded path, intentional
jaxb-api MRJ entries preserved.

Closes apache#4072
and not used / exposed downstream, mirroring the pattern
of fluss-fs-hadoop-shaded -->
<relocation>
<pattern>com.google.re2j</pattern>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

would it be better to shaded the whole com.google(including re2j and common)?

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.

[build] fluss-fs-s3 uber-jar bundles 1,114 unshaded jackson classes that can shadow downstream jackson

2 participants