Skip to content

Commit

Permalink
[FLINK-7778] [build] Shade ZooKeeper dependency (part 1)
Browse files Browse the repository at this point in the history
Shading the ZooKeeper dependency makes sure that this specific version of
ZooKeeper is used by the Flink runtime module. The ZooKeeper version is
sensitive, because we depend on bug fixes in later ZooKeeper versions
for Flink's high availability.

This prevents situations where for example a set of added dependencies (for
example transtive dependencies of Hadoop) cause a different ZooKeeper version
to be in the classpath and be loaded.

This commit also removes the 'flink-shaded-curator' module, which was originally
created to shade guava within curator, but is now obsolete, because newer
versions of curator shade guava already.
  • Loading branch information
StephanEwen committed Nov 2, 2017
1 parent 786a6cb commit 4d02823
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 231 deletions.
38 changes: 30 additions & 8 deletions flink-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@ under the License.
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</dependency>

<dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
Expand All @@ -174,10 +169,26 @@ under the License.
<version>${chill.version}</version>
</dependency>

<!-- Curator and ZooKeeper - we explicitly add ZooKeeper here as
well to make sure our managed version is used -->

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-shaded-curator-recipes</artifactId>
<version>${project.version}</version>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</dependency>

<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>${curator.version}</version>
<exclusions>
<!-- curator shades guava, but still has a dependency on it. -->
<!-- We can safely exclude Guava here -->
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- test dependencies -->
Expand Down Expand Up @@ -437,6 +448,8 @@ under the License.
<include>com.typesafe.akka:akka-remote_*</include>
<include>io.netty:netty</include>
<include>org.uncommons.maths:uncommons-maths</include>
<include>org.apache.curator:*</include>
<include>org.apache.zookeeper:*</include>
</includes>
</artifactSet>
<relocations combine.children="append">
Expand All @@ -452,6 +465,15 @@ under the License.
<pattern>org.apache.curator</pattern>
<shadedPattern>org.apache.flink.shaded.org.apache.curator</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.zookeeper</pattern>
<shadedPattern>org.apache.flink.shaded.org.apache.zookeeper</shadedPattern>
</relocation>
<!-- jute is already shaded into the ZooKeeper jar -->
<relocation>
<pattern>org.apache.jute</pattern>
<shadedPattern>org.apache.flink.shaded.org.apache.zookeeper.jute</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package org.apache.flink.test.recovery;
package org.apache.flink.runtime.jobmanager;

import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.restartstrategy.RestartStrategies;
Expand All @@ -33,7 +33,6 @@
import org.apache.flink.runtime.jobgraph.JobGraph;
import org.apache.flink.runtime.jobgraph.JobStatus;
import org.apache.flink.runtime.jobgraph.JobVertex;
import org.apache.flink.runtime.jobmanager.SubmittedJobGraph;
import org.apache.flink.runtime.leaderelection.TestingListener;
import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService;
import org.apache.flink.runtime.messages.JobManagerMessages;
Expand Down
81 changes: 0 additions & 81 deletions flink-shaded-curator/flink-shaded-curator-recipes/pom.xml

This file was deleted.

95 changes: 0 additions & 95 deletions flink-shaded-curator/flink-shaded-curator-test/pom.xml

This file was deleted.

41 changes: 0 additions & 41 deletions flink-shaded-curator/pom.xml

This file was deleted.

6 changes: 3 additions & 3 deletions flink-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ under the License.
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-shaded-curator-test</artifactId>
<version>${project.version}</version>
<groupId>org.apache.curator</groupId>
<artifactId>curator-test</artifactId>
<version>${curator.version}</version>
<scope>test</scope>
</dependency>

Expand Down
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ under the License.
<module>tools/force-shading</module>
<module>flink-annotations</module>
<module>flink-shaded-hadoop</module>
<module>flink-shaded-curator</module>
<module>flink-core</module>
<module>flink-java</module>
<module>flink-java8</module>
Expand Down

0 comments on commit 4d02823

Please sign in to comment.