From 6b17d449bf93e55c4f373ba96f12af6319a8411c Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Fri, 2 Dec 2016 16:58:43 +0000 Subject: [PATCH] YARN-5915. ATS 1.5 FileSystemTimelineWriter causes flush() to be called after every event write. Contributed by Atul Sikaria --- .../hadoop/yarn/client/api/impl/FileSystemTimelineWriter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/FileSystemTimelineWriter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/FileSystemTimelineWriter.java index 230d98abac0..c4313610601 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/FileSystemTimelineWriter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/FileSystemTimelineWriter.java @@ -283,6 +283,7 @@ public class FileSystemTimelineWriter extends TimelineWriter{ mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector()); mapper.setSerializationInclusion(Inclusion.NON_NULL); mapper.configure(Feature.CLOSE_CLOSEABLE, false); + mapper.configure(Feature.FLUSH_AFTER_WRITE_VALUE, false); return mapper; } @@ -363,6 +364,7 @@ public class FileSystemTimelineWriter extends TimelineWriter{ public void flush() throws IOException { if (stream != null) { + jsonGenerator.flush(); stream.hflush(); } } @@ -375,8 +377,6 @@ public class FileSystemTimelineWriter extends TimelineWriter{ this.stream = createLogFileStream(fs, logPath); this.jsonGenerator = new JsonFactory().createJsonGenerator(stream); this.jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n")); - this.jsonGenerator.configure( - JsonGenerator.Feature.FLUSH_PASSED_TO_STREAM, false); this.lastModifiedTime = Time.monotonicNow(); }