YARN-7124. LogAggregationTFileController deletes/renames while file is open. Contributed by Jason Lowe.
This commit is contained in:
parent
a50be1b8f4
commit
1fcbe7cf5f
@ -96,9 +96,11 @@ public void initializeWriter(LogAggregationFileControllerContext context)
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeWriter() {
|
public void closeWriter() {
|
||||||
|
if (this.writer != null) {
|
||||||
this.writer.close();
|
this.writer.close();
|
||||||
this.writer = null;
|
this.writer = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(LogKey logKey, LogValue logValue) throws IOException {
|
public void write(LogKey logKey, LogValue logValue) throws IOException {
|
||||||
@ -117,6 +119,9 @@ public void postWrite(final LogAggregationFileControllerContext record)
|
|||||||
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
Block a user