|
@@ -586,6 +586,7 @@ class BlockReceiver implements Closeable {
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ datanode.metrics.incrPacketsReceived();
|
|
//First write the packet to the mirror:
|
|
//First write the packet to the mirror:
|
|
if (mirrorOut != null && !mirrorError) {
|
|
if (mirrorOut != null && !mirrorError) {
|
|
try {
|
|
try {
|
|
@@ -601,12 +602,15 @@ class BlockReceiver implements Closeable {
|
|
mirrorAddr,
|
|
mirrorAddr,
|
|
duration);
|
|
duration);
|
|
trackSendPacketToLastNodeInPipeline(duration);
|
|
trackSendPacketToLastNodeInPipeline(duration);
|
|
- if (duration > datanodeSlowLogThresholdMs && LOG.isWarnEnabled()) {
|
|
|
|
- LOG.warn("Slow BlockReceiver write packet to mirror took " + duration
|
|
|
|
- + "ms (threshold=" + datanodeSlowLogThresholdMs + "ms), "
|
|
|
|
- + "downstream DNs=" + Arrays.toString(downstreamDNs)
|
|
|
|
- + ", blockId=" + replicaInfo.getBlockId()
|
|
|
|
- + ", seqno=" + seqno);
|
|
|
|
|
|
+ if (duration > datanodeSlowLogThresholdMs) {
|
|
|
|
+ datanode.metrics.incrPacketsSlowWriteToMirror();
|
|
|
|
+ if (LOG.isWarnEnabled()) {
|
|
|
|
+ LOG.warn("Slow BlockReceiver write packet to mirror took {}ms " +
|
|
|
|
+ "(threshold={}ms), downstream DNs={}, blockId={}, seqno={}",
|
|
|
|
+ duration, datanodeSlowLogThresholdMs,
|
|
|
|
+ Arrays.toString(downstreamDNs), replicaInfo.getBlockId(),
|
|
|
|
+ seqno);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
handleMirrorOutError(e);
|
|
handleMirrorOutError(e);
|
|
@@ -736,13 +740,17 @@ class BlockReceiver implements Closeable {
|
|
long begin = Time.monotonicNow();
|
|
long begin = Time.monotonicNow();
|
|
streams.writeDataToDisk(dataBuf.array(),
|
|
streams.writeDataToDisk(dataBuf.array(),
|
|
startByteToDisk, numBytesToDisk);
|
|
startByteToDisk, numBytesToDisk);
|
|
|
|
+ // no-op in prod
|
|
|
|
+ DataNodeFaultInjector.get().delayWriteToDisk();
|
|
long duration = Time.monotonicNow() - begin;
|
|
long duration = Time.monotonicNow() - begin;
|
|
- if (duration > datanodeSlowLogThresholdMs && LOG.isWarnEnabled()) {
|
|
|
|
- LOG.warn("Slow BlockReceiver write data to disk cost:" + duration
|
|
|
|
- + "ms (threshold=" + datanodeSlowLogThresholdMs + "ms), "
|
|
|
|
- + "volume=" + getVolumeBaseUri()
|
|
|
|
- + ", blockId=" + replicaInfo.getBlockId()
|
|
|
|
- + ", seqno=" + seqno);
|
|
|
|
|
|
+ if (duration > datanodeSlowLogThresholdMs) {
|
|
|
|
+ datanode.metrics.incrPacketsSlowWriteToDisk();
|
|
|
|
+ if (LOG.isWarnEnabled()) {
|
|
|
|
+ LOG.warn("Slow BlockReceiver write data to disk cost: {}ms " +
|
|
|
|
+ "(threshold={}ms), volume={}, blockId={}, seqno={}",
|
|
|
|
+ duration, datanodeSlowLogThresholdMs, getVolumeBaseUri(),
|
|
|
|
+ replicaInfo.getBlockId(), seqno);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (duration > maxWriteToDiskMs) {
|
|
if (duration > maxWriteToDiskMs) {
|
|
@@ -930,13 +938,17 @@ class BlockReceiver implements Closeable {
|
|
POSIX_FADV_DONTNEED);
|
|
POSIX_FADV_DONTNEED);
|
|
}
|
|
}
|
|
lastCacheManagementOffset = offsetInBlock;
|
|
lastCacheManagementOffset = offsetInBlock;
|
|
|
|
+ // For testing. Normally no-op.
|
|
|
|
+ DataNodeFaultInjector.get().delayWriteToOsCache();
|
|
long duration = Time.monotonicNow() - begin;
|
|
long duration = Time.monotonicNow() - begin;
|
|
- if (duration > datanodeSlowLogThresholdMs && LOG.isWarnEnabled()) {
|
|
|
|
- LOG.warn("Slow manageWriterOsCache took " + duration
|
|
|
|
- + "ms (threshold=" + datanodeSlowLogThresholdMs
|
|
|
|
- + "ms), volume=" + getVolumeBaseUri()
|
|
|
|
- + ", blockId=" + replicaInfo.getBlockId()
|
|
|
|
- + ", seqno=" + seqno);
|
|
|
|
|
|
+ if (duration > datanodeSlowLogThresholdMs) {
|
|
|
|
+ datanode.metrics.incrPacketsSlowWriteToOsCache();
|
|
|
|
+ if (LOG.isWarnEnabled()) {
|
|
|
|
+ LOG.warn("Slow manageWriterOsCache took {}ms " +
|
|
|
|
+ "(threshold={}ms), volume={}, blockId={}, seqno={}",
|
|
|
|
+ duration, datanodeSlowLogThresholdMs, getVolumeBaseUri(),
|
|
|
|
+ replicaInfo.getBlockId(), seqno);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (Throwable t) {
|
|
} catch (Throwable t) {
|