HDFS-11583. Parent spans are not initialized to NullScope for every DFSPacket. Contributed by Masatake Iwasaki.
This commit is contained in:
parent
59fab4ea04
commit
f36da00c1f
|
@ -355,6 +355,9 @@ Release 2.7.4 - UNRELEASED
|
||||||
HDFS-11736. OIV tests should not write outside 'target' directory.
|
HDFS-11736. OIV tests should not write outside 'target' directory.
|
||||||
(Yiqun Lin via aajisaka)
|
(Yiqun Lin via aajisaka)
|
||||||
|
|
||||||
|
HDFS-11583. Parent spans are not initialized to NullScope for every
|
||||||
|
DFSPacket. (Masatake Iwasaki via aajisaka)
|
||||||
|
|
||||||
Release 2.7.3 - 2016-08-25
|
Release 2.7.3 - 2016-08-25
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -674,6 +674,7 @@ public class DFSOutputStream extends FSOutputSummer
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
scope.close();
|
scope.close();
|
||||||
|
scope = NullScope.INSTANCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closeInternal();
|
closeInternal();
|
||||||
|
@ -945,6 +946,7 @@ public class DFSOutputStream extends FSOutputSummer
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
scope.close();
|
scope.close();
|
||||||
|
scope = NullScope.INSTANCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,41 @@ public class TestTracing {
|
||||||
readWithTracing();
|
readWithTracing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTracingInDataStreamer() throws Exception {
|
||||||
|
DistributedFileSystem fs = cluster.getFileSystem();
|
||||||
|
FSDataOutputStream os = fs.create(new Path("/testTracingInDataStreamer"));
|
||||||
|
byte[] bytes = "foo-bar-baz".getBytes();
|
||||||
|
|
||||||
|
try (TraceScope ts = Trace.startSpan("top level", Sampler.ALWAYS)) {
|
||||||
|
os.write(bytes);
|
||||||
|
os.hflush();
|
||||||
|
}
|
||||||
|
assertSpanNamesFound(new String[]{ "writeTo" });
|
||||||
|
int spans1 = 0;
|
||||||
|
for (Span s : SetSpanReceiver.SetHolder.spans.values()) {
|
||||||
|
if (s.getDescription().equals("writeTo")) {
|
||||||
|
spans1++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Assert.assertEquals(1, spans1);
|
||||||
|
|
||||||
|
os.write(bytes);
|
||||||
|
os.hflush();
|
||||||
|
os.close();
|
||||||
|
|
||||||
|
int spans2 = 0;
|
||||||
|
for (Span s : SetSpanReceiver.SetHolder.spans.values()) {
|
||||||
|
if (s.getDescription().equals("writeTo")) {
|
||||||
|
spans2++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are multiple "writeTo" spans,
|
||||||
|
// spans are started in DataStreamer even after "top level" span is closed.
|
||||||
|
Assert.assertEquals(spans1, spans2);
|
||||||
|
}
|
||||||
|
|
||||||
public void writeWithTracing() throws Exception {
|
public void writeWithTracing() throws Exception {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
TraceScope ts = Trace.startSpan("testWriteTraceHooks", Sampler.ALWAYS);
|
TraceScope ts = Trace.startSpan("testWriteTraceHooks", Sampler.ALWAYS);
|
||||||
|
|
Loading…
Reference in New Issue