goiri commented on a change in pull request #1954: HDFS-15217 Add more
information to longest write/read lock held log
URL: https://github.com/apache/hadoop/pull/1954#discussion_r407099001
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystemLock.java
##########
@@ -176,13 +181,23 @@ public void readUnlock(String opName) {
final long readLockIntervalMs =
TimeUnit.NANOSECONDS.toMillis(readLockIntervalNanos);
if (needReport && readLockIntervalMs >= this.readLockReportingThresholdMs)
{
- LockHeldInfo localLockHeldInfo;
+ String lockReportInfo = null;
do {
- localLockHeldInfo = longestReadLockHeldInfo.get();
- } while (localLockHeldInfo.getIntervalMs() - readLockIntervalMs < 0 &&
- !longestReadLockHeldInfo.compareAndSet(localLockHeldInfo,
- new LockHeldInfo(currentTimeMs, readLockIntervalMs,
- StringUtils.getStackTrace(Thread.currentThread()))));
+ LockHeldInfo localLockHeldInfo = longestReadLockHeldInfo.get();
+ if (localLockHeldInfo.getIntervalMs() <= readLockIntervalMs) {
+ if (lockReportInfo == null) {
+ lockReportInfo = lockReportInfoSupplier != null ? " (" +
+ lockReportInfoSupplier.get() + ")" : "";
+ }
+ if (longestReadLockHeldInfo.compareAndSet(localLockHeldInfo,
+ new LockHeldInfo(currentTimeMs, readLockIntervalMs,
Review comment:
Can we extract some of this? At least the stack trace.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]