YARN-7124. LogAggregationTFileController deletes/renames while file is open. Contributed by Jason Lowe.
(cherry picked from commit 1fcbe7cf5f
)
This commit is contained in:
parent
0bddcf10ef
commit
3d2ef54450
|
@ -96,8 +96,10 @@ public class LogAggregationTFileController
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeWriter() {
|
public void closeWriter() {
|
||||||
this.writer.close();
|
if (this.writer != null) {
|
||||||
this.writer = null;
|
this.writer.close();
|
||||||
|
this.writer = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -117,6 +119,9 @@ public class LogAggregationTFileController
|
||||||
record.increcleanupOldLogTimes();
|
record.increcleanupOldLogTimes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// close the writer before the file is renamed or deleted
|
||||||
|
closeWriter();
|
||||||
|
|
||||||
final Path renamedPath = record.getRollingMonitorInterval() <= 0
|
final Path renamedPath = record.getRollingMonitorInterval() <= 0
|
||||||
? record.getRemoteNodeLogFileForApp() : new Path(
|
? record.getRemoteNodeLogFileForApp() : new Path(
|
||||||
record.getRemoteNodeLogFileForApp().getParent(),
|
record.getRemoteNodeLogFileForApp().getParent(),
|
||||||
|
|
Loading…
Reference in New Issue