|
@@ -21,6 +21,8 @@ package org.apache.hadoop.fs;
|
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
|
import org.apache.hadoop.classification.InterfaceStability;
|
|
|
import org.apache.hadoop.util.DataChecksum;
|
|
|
+import org.apache.htrace.NullScope;
|
|
|
+import org.apache.htrace.TraceScope;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
@@ -194,16 +196,26 @@ abstract public class FSOutputSummer extends OutputStream {
|
|
|
return sum.getChecksumSize();
|
|
|
}
|
|
|
|
|
|
+ protected TraceScope createWriteTraceScope() {
|
|
|
+ return NullScope.INSTANCE;
|
|
|
+ }
|
|
|
+
|
|
|
/** Generate checksums for the given data chunks and output chunks & checksums
|
|
|
* to the underlying output stream.
|
|
|
*/
|
|
|
private void writeChecksumChunks(byte b[], int off, int len)
|
|
|
throws IOException {
|
|
|
sum.calculateChunkedSums(b, off, len, checksum, 0);
|
|
|
- for (int i = 0; i < len; i += sum.getBytesPerChecksum()) {
|
|
|
- int chunkLen = Math.min(sum.getBytesPerChecksum(), len - i);
|
|
|
- int ckOffset = i / sum.getBytesPerChecksum() * getChecksumSize();
|
|
|
- writeChunk(b, off + i, chunkLen, checksum, ckOffset, getChecksumSize());
|
|
|
+ TraceScope scope = createWriteTraceScope();
|
|
|
+ try {
|
|
|
+ for (int i = 0; i < len; i += sum.getBytesPerChecksum()) {
|
|
|
+ int chunkLen = Math.min(sum.getBytesPerChecksum(), len - i);
|
|
|
+ int ckOffset = i / sum.getBytesPerChecksum() * getChecksumSize();
|
|
|
+ writeChunk(b, off + i, chunkLen, checksum, ckOffset,
|
|
|
+ getChecksumSize());
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ scope.close();
|
|
|
}
|
|
|
}
|
|
|
|