Forráskód Böngészése

YARN-7194. Log aggregation status is always Failed with the newly added log aggregation IndexedFileFormat. Contributed by Xuan Gong.

Junping Du 7 éve
szülő
commit
c92c1d521e

+ 2 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java

@@ -392,7 +392,8 @@ public class LogAggregationIndexedFileController
     this.fsDataOStream.writeInt(length);
     byte[] separator = this.uuid.getBytes(Charset.forName("UTF-8"));
     this.fsDataOStream.write(separator);
-    if (logAggregationSuccessfullyInThisCyCle) {
+    if (logAggregationSuccessfullyInThisCyCle &&
+        record.isLogAggregationInRolling()) {
       deleteFileWithRetries(fc, ugi, remoteLogCheckSumFile);
     }
   }

+ 2 - 4
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/TestLogAggregationIndexFileController.java

@@ -164,9 +164,7 @@ public class TestLogAggregationIndexFileController {
     fileFormat.initializeWriter(context);
 
     fileFormat.write(key1, value);
-    LogAggregationFileControllerContext record = mock(
-        LogAggregationFileControllerContext.class);
-    fileFormat.postWrite(record);
+    fileFormat.postWrite(context);
     fileFormat.closeWriter();
 
     ContainerLogsRequest logRequest = new ContainerLogsRequest();
@@ -267,7 +265,7 @@ public class TestLogAggregationIndexFileController {
     // first write and second write
     fileFormat.initializeWriter(context);
     fileFormat.write(key1, value2);
-    fileFormat.postWrite(record);
+    fileFormat.postWrite(context);
     fileFormat.closeWriter();
     fileFormat.readAggregatedLogsMeta(
             logRequest);