Skip to content
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

[FLINK-33017] Remove dependency on shaded guava #46

Closed

Conversation

Gerrrr
Copy link
Contributor

@Gerrrr Gerrrr commented Sep 5, 2023

Description

The bump in shaded guava in Flink 1.18 changed import paths and caused the class loader fail when loading ManagedMemoryUtils.

Looking at the root cause of the issue, shading was used as a technique to avoid dependency hell. As flink-connector-kafka should work with both flink 1.17 and 1.18 that use different guava versions (and hence library import paths), shading did not really solve the problem it was introduced for in the first place.

There are several several options to work around the problem. First, we could introduce our own shading for guava. Second, we could see if the dependency on guava is necessary at all and maybe remove it completely.

This patch takes the latter route and removes dependency on guava from this connector.

Testing strategy

Ran locally

mvn clean install \
  -U -B --no-transfer-progress -Dflink.version=1.18-SNAPSHOT \
  -Dscala-2.12 \
  -Prun-end-to-end-tests -DdistDir=/Users/asorokoumov/projects/flink-connector-kafka/flink-1.18-SNAPSHOT

and no longer observed Could not initialize class org.apache.flink.runtime.util.config.memory.ManagedMemoryUtils in the logs.

The bump in shaded guava in Flink 1.18 changed import paths and caused
the class loader fail when loading ManagedMemoryUtils.

Looking at the root cause of the issue, shading was used as a technique
to avoid dependency hell. As flink-connector-kafka should work with both
flink 1.17 and 1.18 that use different guava versions (and hence library
import paths), shading did not really solve the problem it was introduced
for in the first place.

There are several several options to work around the problem. First,
we could introduce our own shading for guava. Second, we could see if
the dependency on guava is necessary at all and maybe remove it
completely.

This patch takes the latter route and removes dependency on guava from
this connector.
* rename closeables to producerCloseables
* change the order of calls in KafkaWriter#close
@tzulitai
Copy link
Contributor

Closed via 818d1fd

@tzulitai tzulitai closed this Sep 12, 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.

2 participants