hive icon indicating copy to clipboard operation
hive copied to clipboard

HIVE-28417: Bump Log4j2 to 2.24.1 to facilitate compilation of GraalVM Native Image

Open linghengqian opened this issue 1 year ago • 4 comments

What changes were proposed in this pull request?

  • Bump Log4j2 to 2.24.1 to facilitate compilation of GraalVM Native Image.

Why are the changes needed?

  • This PR is aimed at ensuring that HiveServer2 JDBC Driver is compatible with future versions of LOG4J as much as possible. I created a unit test at https://github.com/linghengqian/log4j2-v2231-graalvm-native-image-test to prove that the HiveServer2 JDBC Driver using apache/logging-log4j2:2.23.1 can be used under the GraalVM Native Image compiled by GraalVM CE For JDK 22.0.2.
sdk install java 8.0.422-tem
sdk install java 22.0.2-graalce
sdk use java 8.0.422-tem
sdk install maven
git clone [email protected]:linghengqian/hive.git -b log4j-bump
cd ./hive/
mvn clean install -DskipTests
mvn clean package -pl packaging -DskipTests -Pdocker
cd ../

git clone [email protected]:linghengqian/log4j2-v2231-graalvm-native-image-test.git
cd ./log4j2-v2231-graalvm-native-image-test/
sdk use java 22.0.2-graalce
./mvnw -PgenerateMetadata -DskipNativeTests -e -T1C clean test native:metadata-copy
./mvnw -PnativeTestInHive -T1C -e clean test
  • See also https://github.com/apache/logging-log4j2/blob/rel/2.23.1/src/changelog/2.20.0/LOG4J2-3650_Move_tests.xml .
Moved `log4j-api` and `log4j-core` artifacts with classifier `tests` to `log4j-api-test` and `log4j-core-test` respectively. 
  • See also https://github.com/apache/logging-log4j2/issues/1291#issuecomment-1450793036 .
I took care of the [release notes](https://logging.apache.org/log4j/2.x/release-notes/2.20.0.html).

The difference in dependencies is caused by Maven:

for the log4j-core artifact with tests classifier Maven pulled the wrong dependencies (compile scope instead of test scope),
for the log4j-core-test artifact the real dependencies are no longer hidden: the artifact mostly contains JUnit 4 and JUnit 5 extensions, so it depends on all those libraries.
  • See also https://github.com/apache/logging-log4j2/pull/1032 . The constructor of org.apache.logging.slf4j.Log4jMarker has changed.
  • See also https://github.com/apache/logging-log4j2/issues/2791 and https://github.com/apache/logging-log4j2/issues/2794 . The Log4j configuration file used by Hive contains deprecated properties .

Does this PR introduce any user-facing change?

No.

Is the change a dependency upgrade?

How was this patch tested?

sdk install java 8.0.422-tem
sdk use java 8.0.422-tem
sdk install maven
mvn clean install -DskipTests
mvn test -Dtest=TestHplsqlLocal -pl hplsql
mvn test -Dtest=TestHplsqlOffline -pl hplsql

linghengqian avatar Jul 31 '24 11:07 linghengqian

Had 1 question, added it as comment. Otherwise java and pom changes LGTM (+1 non-binding).

Aggarwal-Raghav avatar Aug 06 '24 16:08 Aggarwal-Raghav

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Feel free to reach out on the [email protected] list if the patch is in need of reviews.

github-actions[bot] avatar Oct 06 '24 00:10 github-actions[bot]