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

GH-40907: [Java][FlightSQL] Shade slf4j-api in JDBC driver #40908

Merged
merged 2 commits into from
Apr 2, 2024

Conversation

laurentgo
Copy link
Collaborator

@laurentgo laurentgo commented Mar 30, 2024

Rationale for this change

FlightSQL JDBC Driver does not shade slfj4 api which may come into conflict into the version used by an application. If the application uses slf4j 1.x, it may cause the application slf4j backend to not be loaded properly.

The change configured maven-shade-plugin to also shade slf4j-api. To make sure log messages are still visible, slf4j-jdk14 is included as well so that all messages will be redirected to java.util.logging framework. The application can use jul-to-slf4j adapter to redirect log messages back to slf4j.

What changes are included in this PR?

Overrides Driver#getParentLogger() to return the root logger for the JDBC driver (which is org.apache.arrow.driver.jdbc). To make sure shaded dependencies loggers are included as well, change relocation from cfjd. to org.apache.arrow.driver.jdbc.shaded. (or oaadj for native libraries)

Are these changes tested?

Verifying that slf4j-api is shaded along with the other relocation changes are covered by ITDriverJarValidation

Are there any user-facing changes?

Yes. Driver will not expose directly slf4j api and the logger names for the shaded dependencies have been updated. For applications which were relying on configuring directly a slf4j logging backend for the driver, they may need to include org.slf4j:slf4-api and org.slf4j:jul-to-slf4j for logging configuration to work.

FlightSQL JDBC Driver does not shade slfj4 api which may come into
conflict into the version used by an application. If the application
uses slf4j 1.x, it may cause the application slf4j backend to not be
loaded properly.

The change configured maven-shade-plugin to also shade slf4j-api. To
make sure log messages are still visible, slf4j-jdk14 is included as
well so that all messages will be redirected to java.util.logging
framework. The application can use jul-to-slf4j adapter to redirect log
messages back to slf4j.

Overrides Driver#getParentLogger() to return the root logger for the
JDBC driver (which is `org.apache.arrow.driver.jdbc`). To make sure
shaded dependencies loggers are included as well, change relocation
from cfjd.  to org.apache.arrow.driver.jdbc.shaded. (or oaadj for
native libraries)
Copy link

⚠️ GitHub issue #40907 has been automatically assigned in GitHub to PR creator.

Class#getPackageName() is Java9+ only
@vibhatha
Copy link
Collaborator

@github-actions crossbow submit -g java

Copy link

Revision: 3008f79

Submitted crossbow builds: ursacomputing/crossbow @ actions-b5deb1933b

Task Status
java-jars GitHub Actions
verify-rc-source-java-linux-almalinux-8-amd64 GitHub Actions
verify-rc-source-java-linux-conda-latest-amd64 GitHub Actions
verify-rc-source-java-linux-ubuntu-20.04-amd64 GitHub Actions
verify-rc-source-java-linux-ubuntu-22.04-amd64 GitHub Actions
verify-rc-source-java-macos-amd64 GitHub Actions

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Mar 30, 2024
@@ -58,7 +59,7 @@ public class ArrowFlightJdbcDriver extends UnregisteredDriver {
// Netty requires some extra properties to unlock some native memory management api
// Setting this property if not already set externally
// This has to be done before any netty class is being loaded
final String key = "cfjd.io.netty.tryReflectionSetAccessible";
final String key = "io.netty.tryReflectionSetAccessible";
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to support both the old and the new keys to minimize potential compatibility breaks?

Copy link
Member

Choose a reason for hiding this comment

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

@lidavidm do you mean testing/shading both cfjd and regular shading ? I think it could be confusing for users. Just wondering.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The main use of this property is to be set directly by the driver (not the users) in order for the driver to actually work. Checking if it is set sounds more like a debugging capability.

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Mar 31, 2024
@lidavidm lidavidm merged commit 42b49df into apache:main Apr 2, 2024
20 of 21 checks passed
@lidavidm lidavidm removed the awaiting changes Awaiting changes label Apr 2, 2024
@laurentgo laurentgo deleted the laurentgo/slf4j-shading branch April 2, 2024 17:55
Copy link

After merging your PR, Conbench analyzed the 5 benchmarking runs that have been run so far on merge-commit 42b49df.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 1 possible false positive for unstable benchmarks that are known to sometimes produce them.

tolleybot pushed a commit to tmct/arrow that referenced this pull request May 2, 2024
…che#40908)

### Rationale for this change

FlightSQL JDBC Driver does not shade slfj4 api which may come into conflict into the version used by an application. If the application uses slf4j 1.x, it may cause the application slf4j backend to not be loaded properly.

The change configured maven-shade-plugin to also shade slf4j-api. To make sure log messages are still visible, slf4j-jdk14 is included as well so that all messages will be redirected to `java.util.logging` framework. The application can use jul-to-slf4j adapter to redirect log messages back to slf4j.

### What changes are included in this PR?

Overrides `Driver#getParentLogger()` to return the root logger for the JDBC driver (which is `org.apache.arrow.driver.jdbc`). To make sure shaded dependencies loggers are included as well, change relocation from `cfjd.`  to `org.apache.arrow.driver.jdbc.shaded. `(or `oaadj` for native libraries)

### Are these changes tested?

Verifying that slf4j-api is shaded along with the other relocation changes are covered by `ITDriverJarValidation`

### Are there any user-facing changes?

Yes. Driver will not expose directly slf4j api and the logger names for the shaded dependencies have been updated. For applications which were relying on configuring directly a slf4j logging backend for the driver, they may need to include `org.slf4j:slf4-api` and `org.slf4j:jul-to-slf4j` for logging configuration to work.
* GitHub Issue: apache#40907

Authored-by: Laurent Goujon <laurent@apache.org>
Signed-off-by: David Li <li.davidm96@gmail.com>
tolleybot pushed a commit to tmct/arrow that referenced this pull request May 4, 2024
…che#40908)

### Rationale for this change

FlightSQL JDBC Driver does not shade slfj4 api which may come into conflict into the version used by an application. If the application uses slf4j 1.x, it may cause the application slf4j backend to not be loaded properly.

The change configured maven-shade-plugin to also shade slf4j-api. To make sure log messages are still visible, slf4j-jdk14 is included as well so that all messages will be redirected to `java.util.logging` framework. The application can use jul-to-slf4j adapter to redirect log messages back to slf4j.

### What changes are included in this PR?

Overrides `Driver#getParentLogger()` to return the root logger for the JDBC driver (which is `org.apache.arrow.driver.jdbc`). To make sure shaded dependencies loggers are included as well, change relocation from `cfjd.`  to `org.apache.arrow.driver.jdbc.shaded. `(or `oaadj` for native libraries)

### Are these changes tested?

Verifying that slf4j-api is shaded along with the other relocation changes are covered by `ITDriverJarValidation`

### Are there any user-facing changes?

Yes. Driver will not expose directly slf4j api and the logger names for the shaded dependencies have been updated. For applications which were relying on configuring directly a slf4j logging backend for the driver, they may need to include `org.slf4j:slf4-api` and `org.slf4j:jul-to-slf4j` for logging configuration to work.
* GitHub Issue: apache#40907

Authored-by: Laurent Goujon <laurent@apache.org>
Signed-off-by: David Li <li.davidm96@gmail.com>
rok pushed a commit to tmct/arrow that referenced this pull request May 8, 2024
…che#40908)

### Rationale for this change

FlightSQL JDBC Driver does not shade slfj4 api which may come into conflict into the version used by an application. If the application uses slf4j 1.x, it may cause the application slf4j backend to not be loaded properly.

The change configured maven-shade-plugin to also shade slf4j-api. To make sure log messages are still visible, slf4j-jdk14 is included as well so that all messages will be redirected to `java.util.logging` framework. The application can use jul-to-slf4j adapter to redirect log messages back to slf4j.

### What changes are included in this PR?

Overrides `Driver#getParentLogger()` to return the root logger for the JDBC driver (which is `org.apache.arrow.driver.jdbc`). To make sure shaded dependencies loggers are included as well, change relocation from `cfjd.`  to `org.apache.arrow.driver.jdbc.shaded. `(or `oaadj` for native libraries)

### Are these changes tested?

Verifying that slf4j-api is shaded along with the other relocation changes are covered by `ITDriverJarValidation`

### Are there any user-facing changes?

Yes. Driver will not expose directly slf4j api and the logger names for the shaded dependencies have been updated. For applications which were relying on configuring directly a slf4j logging backend for the driver, they may need to include `org.slf4j:slf4-api` and `org.slf4j:jul-to-slf4j` for logging configuration to work.
* GitHub Issue: apache#40907

Authored-by: Laurent Goujon <laurent@apache.org>
Signed-off-by: David Li <li.davidm96@gmail.com>
rok pushed a commit to tmct/arrow that referenced this pull request May 8, 2024
…che#40908)

### Rationale for this change

FlightSQL JDBC Driver does not shade slfj4 api which may come into conflict into the version used by an application. If the application uses slf4j 1.x, it may cause the application slf4j backend to not be loaded properly.

The change configured maven-shade-plugin to also shade slf4j-api. To make sure log messages are still visible, slf4j-jdk14 is included as well so that all messages will be redirected to `java.util.logging` framework. The application can use jul-to-slf4j adapter to redirect log messages back to slf4j.

### What changes are included in this PR?

Overrides `Driver#getParentLogger()` to return the root logger for the JDBC driver (which is `org.apache.arrow.driver.jdbc`). To make sure shaded dependencies loggers are included as well, change relocation from `cfjd.`  to `org.apache.arrow.driver.jdbc.shaded. `(or `oaadj` for native libraries)

### Are these changes tested?

Verifying that slf4j-api is shaded along with the other relocation changes are covered by `ITDriverJarValidation`

### Are there any user-facing changes?

Yes. Driver will not expose directly slf4j api and the logger names for the shaded dependencies have been updated. For applications which were relying on configuring directly a slf4j logging backend for the driver, they may need to include `org.slf4j:slf4-api` and `org.slf4j:jul-to-slf4j` for logging configuration to work.
* GitHub Issue: apache#40907

Authored-by: Laurent Goujon <laurent@apache.org>
Signed-off-by: David Li <li.davidm96@gmail.com>
vibhatha pushed a commit to vibhatha/arrow that referenced this pull request May 25, 2024
…che#40908)

### Rationale for this change

FlightSQL JDBC Driver does not shade slfj4 api which may come into conflict into the version used by an application. If the application uses slf4j 1.x, it may cause the application slf4j backend to not be loaded properly.

The change configured maven-shade-plugin to also shade slf4j-api. To make sure log messages are still visible, slf4j-jdk14 is included as well so that all messages will be redirected to `java.util.logging` framework. The application can use jul-to-slf4j adapter to redirect log messages back to slf4j.

### What changes are included in this PR?

Overrides `Driver#getParentLogger()` to return the root logger for the JDBC driver (which is `org.apache.arrow.driver.jdbc`). To make sure shaded dependencies loggers are included as well, change relocation from `cfjd.`  to `org.apache.arrow.driver.jdbc.shaded. `(or `oaadj` for native libraries)

### Are these changes tested?

Verifying that slf4j-api is shaded along with the other relocation changes are covered by `ITDriverJarValidation`

### Are there any user-facing changes?

Yes. Driver will not expose directly slf4j api and the logger names for the shaded dependencies have been updated. For applications which were relying on configuring directly a slf4j logging backend for the driver, they may need to include `org.slf4j:slf4-api` and `org.slf4j:jul-to-slf4j` for logging configuration to work.
* GitHub Issue: apache#40907

Authored-by: Laurent Goujon <laurent@apache.org>
Signed-off-by: David Li <li.davidm96@gmail.com>
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.

4 participants