HADOOP-17938. Print lockWarningThreshold in InstrumentedLock#logWarni… (#3485)

Reviewed-by: Hui Fei <ferhui@apache.org>
(cherry picked from commit 211db3fe08)
This commit is contained in:
litao 2021-10-01 10:21:14 +08:00 committed by Wei-Chiu Chuang
parent 4475d8bfe7
commit 5ed4274f38
No known key found for this signature in database
GPG Key ID: B362E1C021854B9D
1 changed files with 4 additions and 4 deletions

View File

@ -150,23 +150,23 @@ public class InstrumentedLock implements Lock {
@VisibleForTesting @VisibleForTesting
void logWarning(long lockHeldTime, SuppressedSnapshot stats) { void logWarning(long lockHeldTime, SuppressedSnapshot stats) {
logger.warn(String.format("Lock held time above threshold: " + logger.warn(String.format("Lock held time above threshold(%d ms): " +
"lock identifier: %s " + "lock identifier: %s " +
"lockHeldTimeMs=%d ms. Suppressed %d lock warnings. " + "lockHeldTimeMs=%d ms. Suppressed %d lock warnings. " +
"Longest suppressed LockHeldTimeMs=%d. " + "Longest suppressed LockHeldTimeMs=%d. " +
"The stack trace is: %s" , "The stack trace is: %s" ,
name, lockHeldTime, stats.getSuppressedCount(), lockWarningThreshold, name, lockHeldTime, stats.getSuppressedCount(),
stats.getMaxSuppressedWait(), stats.getMaxSuppressedWait(),
StringUtils.getStackTrace(Thread.currentThread()))); StringUtils.getStackTrace(Thread.currentThread())));
} }
@VisibleForTesting @VisibleForTesting
void logWaitWarning(long lockWaitTime, SuppressedSnapshot stats) { void logWaitWarning(long lockWaitTime, SuppressedSnapshot stats) {
logger.warn(String.format("Waited above threshold to acquire lock: " + logger.warn(String.format("Waited above threshold(%d ms) to acquire lock: " +
"lock identifier: %s " + "lock identifier: %s " +
"waitTimeMs=%d ms. Suppressed %d lock wait warnings. " + "waitTimeMs=%d ms. Suppressed %d lock wait warnings. " +
"Longest suppressed WaitTimeMs=%d. " + "Longest suppressed WaitTimeMs=%d. " +
"The stack trace is: %s", name, lockWaitTime, "The stack trace is: %s", lockWarningThreshold, name, lockWaitTime,
stats.getSuppressedCount(), stats.getMaxSuppressedWait(), stats.getSuppressedCount(), stats.getMaxSuppressedWait(),
StringUtils.getStackTrace(Thread.currentThread()))); StringUtils.getStackTrace(Thread.currentThread())));
} }