-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-28983: Log HS2 and HMS PID and update hive-env.sh template #5884
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
Conversation
@ayushtkn @deniskuzZ , I would like to get you opinion on this small improvement patch. I have done this in our internal hive distribution and has helped a lot. |
HMS log will look like
HS2 log will look like
|
@@ -1206,7 +1206,8 @@ public void startPrivilegeSynchronizer(HiveConf hiveConf) throws Exception { | |||
private static void startHiveServer2() throws Throwable { | |||
long attempts = 0, maxAttempts = 1; | |||
while (true) { | |||
LOG.info("Starting HiveServer2"); | |||
long pid = ProcessHandle.current().pid(); |
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.
Do we need a separate var for pid extraction?
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.
We can inline it in LOG message in both HS2 and HMS, if you think that's best.
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.
not sure, I am just used to inline when the var is not used in multiple places
conf/hive-env.sh.template
Outdated
# if [ -z "$DEBUG" ]; then | ||
# export HADOOP_OPTS="$HADOOP_OPTS -XX:NewRatio=12 -Xms10m -XX:MaxHeapFreeRatio=40 -XX:MinHeapFreeRatio=15 -XX:+UseParNewGC -XX:-UseGCOverheadLimit" | ||
# export HADOOP_OPTS="$HADOOP_OPTS -XX:NewRatio=12 -Xms10m -XX:MaxHeapFreeRatio=40 -XX:MinHeapFreeRatio=15 -XX:+G1GC -XX:-UseGCOverheadLimit" |
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.
Can we remove -XX:+G1GC
since it's the default with JDK 17+? I also see -XX:NewRatio is not recommended. However, as I don't know the intention of the DEBUG option, we may keep it.
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.
-XX:+UseG1GC
is the correct one?
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.
Thanks for the review @okumin. Few points:
- Yes -
XX:+UseG1GC
is the correct one. I doubled confirmed using:
java -XX:+UnlockExperimentalVMOptions -XX:+PrintFlagsFinal -version | grep -i "G1GC"
- Regarding removing the GC flags and NewRatio, I am inclined towards removing every flag other than Xmx and Xms. Reason being, G1GC and ZGC doesn't require much tuning and tuning should be system specific + workload specifc which varies cluster to cluster.
- I "want to believe" that the DEBUG option is there to showcase user the possibilities / kind of tuning users can do.
Let me know your thoughts based on that I will update the PR.
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.
sorry, just to confirm, -XX:+G1GC
was replaced with XX:+UseG1GC
? if yes, we still have -XX:+G1GC
in beeline HADOOP_OPTS and need to replace
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.
Addressed in ba2c9ca
...metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.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, pending tests
conf/hive-env.sh.template
Outdated
# export HIVE_AUX_JARS_PATH= | ||
# if [ "$SERVICE" = "metastore" ]; then | ||
# export HADOOP_HEAPSIZE=1024 | ||
# export HADOOP_OPTS="$HADOOP_OPTS -Dhive.log.dir=$HIVE_LOG_DIR -Dhive.log.file=hive$SERVICE.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.
@Aggarwal-Raghav Have you did the test using the latest master code?
I found that HADOOP_OPTS
cannot make the Hive log directory take effect. It was only after I changed to HADOOP_CLIENT_OPTS
that it worked. However, it was indeed possible to take effect by using HADOOP_OPTS
in the past.
The screenshot shows that I deployed Hive 4.1.0 locally. I had to modify HADOOP_CLIENT_OPTS
to make the log directory effective.
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.
@zhangbutao , thanks for looking into this and yes, you are correct. Even in my setup I have HADOOP_CLIENT_OPTS
for quite some time:
https://github.com/Aggarwal-Raghav/hive-mac-setup/blob/main/hive/hive-env.sh
But reason why I went ahead with HADOOP_OPTS
:
- In my prod clusters, we have HADOOP_OPTS set in hive-env.sh in Amabri UI and it's working as expected.
- Even in Ambari opensource,
HADOOP_OPTS
is used:
https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HIVE/configuration/hive-env.xml#L376 - Because of point [1] and [2], I stick to HADOOP_OPTS which are also present in older hive-env.sh.template in hive,
Let me know what are your thoughts on this? Should I change to HADOOP_CLIENT_OPTS
in hive-env.sh.template
?
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.
I just want to confirm whether HADOOP_OPTS will make the Hive directory configuration take effect. Because it didn't seem to work in my test environment using latest branch, then I switched to using HADOOP_CLIENT_OPTS.
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.
No, I also can't make HADOOP_OPTS work.
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.
Sorry, I'd like to confirm again to avoid any misunderstanding due to my unclear description.
When I was testing the latest&branch-4.1 code, I found that the hive log parameters configured with HADOOP_OPTS
(Dhive.log.dir=$HIVE_LOG_DIR -Dhive.log.file=hive$SERVICE.log) were not taking effect, and I didn't see any log file in the specified hive.log.dir
. Only when I replaced HADOOP_OPTS
with HADOOP_CLIENT_OPTS
did this log directory take effect.
But I'm not sure where the problem lies that causes this situation, because before this, I was able to make the hive.log.dir parameter take effect by using HADOOP_OPTS.
So, if your current test results are the same as mine, it might be a problem caused by changes in the Hive code. If this issue is real, it would be best to fix it on the Hive side. Otherwise, similar downstream components like Ambari might have to modify their code to adapt to the new HADOOP_CLIENT_OPTS
parameter, which could be quite troublesome.
Moving from
@deniskuzZ @zhangbutao , can you please review once again? |
|
If this is the issue, could we add Lines 53 to 54 in 925df92
|
I did this change, and using |
@zhangbutao , the patch that you have sent above is not what I meant regarding add-opens. Let me rephrase, It seems HADOOP_OPTS are not picked up for starting hive services no matter where you set them i.e. In HIVE-26473, all the add-opens were appended in HADOOP_CLIENT_OPTS, that's why I changed from HADOOP_OPTS => HADOOP_CLIENT_OPTS in |
Yes, I understand what you mean. Maybe we can address this issue later. |
Just to clarify, i think it was not working way before HIVE-26473. |
OK. It might also be a issue caused by other PR. Because previously, when I conducted local tests, using |
@Aggarwal-Raghav I have just figured out the reason why the Because in order for So when Hive starts, the value of the Therefore, in order to prevent the parameters in hive-env.sh from being overridden by those in hadoop-env.sh, we can specify a clean hadoop-env.sh file for hive (a separate hadoop client for hive) Back to this current PR, regarding whether we should change the hive/service/src/java/org/apache/hive/service/server/HiveServer2.java Lines 1469 to 1480 in 925df92
But I also want to hear the opinions of the other folks. :) Thanks. |
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
@okumin @deniskuzZ Thanks for the reivew! |
What changes were proposed in this pull request?
Log the HS2 and HMS PID in their respective logs and give sample hms and hs2 HADOOP_OPTS in hive-env.sh.template.
Why are the changes needed?
During debugging prod issue, I saw the need for this.
java_pid14784.hprof
, it becomes difficult to identify whether it belongs to HMS or HS2 without loading it in any analyzer tool.Does this PR introduce any user-facing change?
Yes, in HS2 and HMS logs PID will be logged
How was this patch tested?
On local setup