-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
HIVE-28417: Bump Log4j2 to 2.24.1 to facilitate compilation of GraalVM Native Image #5375
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- @pgaref I don't understand why the bot didn't update the github tag after I put the PR back for review. Do you know how to make the bot update the github tag again?
- update 1st: To be honest, I can't understand the error log of https://ci.hive.apache.org/blue/organizations/jenkins/hive-precommit/detail/PR-5375/5/tests .
Unexpected exception java.lang.RuntimeException: Process docker failed to run in 30 seconds
at org.apache.hadoop.hive.ql.externalDB.AbstractExternalDB.runCmd(AbstractExternalDB.java:91)
at org.apache.hadoop.hive.ql.externalDB.AbstractExternalDB.runCmdAndPrintStreams(AbstractExternalDB.java:106)
- update 2nd: I took a moment to get to know the Jenkins UI... Looks like it should work, right?
- update 3rd: Wait Fix handling of
onMatch
andonMismatch
attributes in the properties configuration format logging-log4j2#2791 . - update 4th: All done.
3c8dd38
to
dddaef4
Compare
dddaef4
to
bced6fd
Compare
bced6fd
to
74d4f7f
Compare
74d4f7f
to
b29964e
Compare
Had 1 question, added it as comment. Otherwise java and pom changes LGTM (+1 non-binding). |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to the bugs https://issues.apache.org/jira/browse/HIVE-28559 and https://issues.apache.org/jira/browse/HIVE-28552, I can't actually merge the master branch directly.
name = HiveLog4j2Test | ||
packages = org.apache.hadoop.hive.ql.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- According to Fix handling of
onMatch
andonMismatch
attributes in the properties configuration format logging-log4j2#2791, we no longer need such list definition, log4j2 will scan it automatically. Not surprisingly, retaining this attribute causes the warning.
2024-08-02T10:55:16.634Z main WARN The use of package scanning to locate plugins is deprecated and will be removed in a future release
2024-08-02T10:55:16.650Z main WARN The use of package scanning to locate plugins is deprecated and will be removed in a future release
2024-08-02T10:55:16.670Z main WARN The use of package scanning to locate plugins is deprecated and will be removed in a future release
2024-08-02T10:55:16.686Z main WARN The use of package scanning to locate plugins is deprecated and will be removed in a future release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of the packages attribute is deprecated and will be removed in Log4j 3.0. Plugins should be processed with the Log4j annotation processor. A comma separated list of package names to search for plugins. Plugins are only loaded once per classloader so changing this value may not have any effect upon reconfiguration.
How we replace packages
with the new way? I think removing package
will cause some unkown issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How we replace
packages
with the new way? I think removingpackage
will cause some unkown issue.
- I would say that even without merging this PR,
packages
never worked in Hive. Unless Hive has always used log4j1 and never used log4j2. Because the classorg.apache.logging.log4j.core.config.plugins.processor.PluginProcessor
exists in the JAR of the final binary of Hive,org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor
generatesLog4j2Plugins.dat
, which directly covers the operation ofpackages
. It is located at/hive/ql/target/hive-exec-4.1.0-SNAPSHOT.jar!/META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
.packages
is actually alog4j1
thing. - You can determine from a comment by a log4j2 committer that this property does not actually take effect. See Fix handling of
onMatch
andonMismatch
attributes in the properties configuration format logging-log4j2#2791 (comment) .
There is no problem in Apache Hive: I checked that the appropriate annotation processor is configured in the
hive-exec
project and there is aLog4j2Plugins.dat
file in the JAR. You can safely remove the packages configuration attribute.
-
org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor
is available since log4j2 2.0. The processor will generate the necessaryMETA-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
descriptor that replaces classpath scanning. See After modularization of Log4j2, loading the plugin (PluginManager. addPackage) fails logging-log4j2#2434 (comment) . There is also an intuitive PR at Removes the deprecatedpackages
Log4j configuration attribute jmeter#6326 . -
Since Hive has neither CI for JDK23 and JDK24 nor CI for GraalVM Native Image, we actually don't need to register a
org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor
inpom.xml
as https://logging.apache.org/log4j/2.x/manual/plugins.html#plugin-registry .
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<executions>
<execution>
<id>generate-log4j-plugin-descriptor</id>
<goals>
<goal>compile</goal>
</goals>
<phase>process-classes</phase>
<configuration>
<proc>only</proc>
<annotationProcessorPaths>
<path>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.24.1</version>
</path>
</annotationProcessorPaths>
<annotationProcessors>
<processor>org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor</processor>
</annotationProcessors>
</configuration>
</execution>
</executions>
</plugin>
- You may ask why. The reason is simple, because for JDK8-JDK22, the default value of the JVM parameter
-proc
isfull
. The JVM parameter-proc
did not becomeonly
until JDK23.-proc
offull
means that all processors are included by default. See Support compiling and using ShardingSphere under OpenJDK 23 shardingsphere#33025 and OpenJDK Committer’s Blog https://inside.java/2024/06/18/quality-heads-up/ . I also suspect that the ASF Jenkins node has an outdated JDK8 version and does not actually recognize the-proc
JVM parameter, just like the Temurin JDK 8 on the Github Actions Runner also does not recognize the-proc
JVM parameter. - Are there unit tests for Hive Exec under GraalVM Native Image compiled by GraalVM CE For JDK22 and GraalVM CE For JDK23? Yes, they are at https://github.com/linghengqian/hive-server2-jdbc-driver and https://github.com/apache/shardingsphere . Due to the ongoing dispute of https://issues.apache.org/jira/browse/HIVE-28445, I have to maintain Hive's Thin JAR outside of Hive to provide it for unit testing of ShardingSphere under GraalVM Native Image.
- Does
packages = org.apache.hadoop.hive.ql.log
affect things likelogger.Operator.name = org.apache.hadoop.hive.ql.exec.Operator
? Apparently not. Most people usepackages
because they are actually using log4j1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good explanation!
Since Hive has neither CI for JDK23 and JDK24 nor CI for GraalVM Native Image, we actually don't need to register a org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor in pom.xml as https://logging.apache.org/log4j/2.x/manual/plugins.html#plugin-registry .
BTW, if Hive wants to use JDK23 or JDK24, should we need to register the PluginProcessor
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, if Hive wants to use JDK23 or JDK24, should we need to register the PluginProcessor ?
- The answer is yes. But I think most people will actually choose to set
-proc:full
for JDK23
to make JDK23
behave the same as JDK8.-proc:full
is only available on11.0.23
,17.0.11
, JDK21
-24
.-proc:full
is not available on any OpenJDK 8u,-proc:full
is only available on Oracle's closed source JDK8u411
. - For JDK23, we can set
<maven.compiler.proc>full</maven.compiler.proc>
in a separate Maven Profile to make JDK23 behave the same as JDK 8. Refer to Support building Example module with OpenJDK 23 shardingsphere#33224 for the solution. - I would say setting
<maven.compiler.proc>full</maven.compiler.proc>
is not useful for Hive, as I found that the master branch of Hive cannot be compiled with JDK22. This means that none of the unit tests will be affected.
dad81a5
to
b389aba
Compare
Quality Gate passedIssues Measures |
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/QueryTracker.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 LGTM
Thanks for the patch!
What changes were proposed in this pull request?
Why are the changes needed?
apache/logging-log4j2:2.23.1
can be used under the GraalVM Native Image compiled by GraalVM CE For JDK 22.0.2.org.apache.logging.slf4j.Log4jMarker
has changed.onMatch
andonMismatch
attributes in the properties configuration format logging-log4j2#2791 and When bump from 2.23.0 to 2.23.1, thestatus
of the.properties
configuration file no longer works logging-log4j2#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?
Below is the output of
mvn dependency:tree > ./dependency-tree.txt
.dependency-tree.txt
How was this patch tested?