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

View File

@ -711,6 +711,10 @@ private int receivePacket() throws IOException {
streams.writeDataToDisk(dataBuf.array(), streams.writeDataToDisk(dataBuf.array(),
startByteToDisk, numBytesToDisk); startByteToDisk, numBytesToDisk);
long duration = Time.monotonicNow() - begin; 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) { if (duration > maxWriteToDiskMs) {
maxWriteToDiskMs = duration; maxWriteToDiskMs = duration;