From 211db3fe0804b47967b4e103f61a12370ee953e3 Mon Sep 17 00:00:00 2001 From: litao Date: Fri, 1 Oct 2021 10:21:14 +0800 Subject: [PATCH] =?UTF-8?q?HADOOP-17938.=20Print=20lockWarningThreshold=20?= =?UTF-8?q?in=20InstrumentedLock#logWarni=E2=80=A6=20(#3485)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Hui Fei --- .../java/org/apache/hadoop/util/InstrumentedLock.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedLock.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedLock.java index a5f4f0709d..65a68a9467 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedLock.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedLock.java @@ -150,23 +150,23 @@ public Condition newCondition() { @VisibleForTesting 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 " + "lockHeldTimeMs=%d ms. Suppressed %d lock warnings. " + "Longest suppressed LockHeldTimeMs=%d. " + "The stack trace is: %s" , - name, lockHeldTime, stats.getSuppressedCount(), + lockWarningThreshold, name, lockHeldTime, stats.getSuppressedCount(), stats.getMaxSuppressedWait(), StringUtils.getStackTrace(Thread.currentThread()))); } @VisibleForTesting 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 " + "waitTimeMs=%d ms. Suppressed %d lock wait warnings. " + "Longest suppressed WaitTimeMs=%d. " + - "The stack trace is: %s", name, lockWaitTime, + "The stack trace is: %s", lockWarningThreshold, name, lockWaitTime, stats.getSuppressedCount(), stats.getMaxSuppressedWait(), StringUtils.getStackTrace(Thread.currentThread()))); }