HDFS-11547. Add logs for slow BlockReceiver while writing data to disk. Contributed by Xiaobing Zhou.

This commit is contained in:
Arpit Agarwal 2017-03-17 19:02:24 -07:00
parent e1a99802fc
commit ffa160ddb8
1 changed files with 4 additions and 0 deletions

View File

@ -711,6 +711,10 @@ class BlockReceiver implements Closeable {
streams.writeDataToDisk(dataBuf.array(),
startByteToDisk, numBytesToDisk);
long duration = Time.monotonicNow() - begin;
if (duration > datanodeSlowLogThresholdMs) {
LOG.warn("Slow BlockReceiver write data to disk cost:" + duration
+ "ms (threshold=" + datanodeSlowLogThresholdMs + "ms)");
}
if (duration > maxWriteToDiskMs) {
maxWriteToDiskMs = duration;