mirror of https://github.com/apache/druid.git
fix cleanup of tmp dir in HdfsDataSegmentPusher (#3636)
This commit is contained in:
parent
f1dee037d6
commit
eb70a12e43
|
@ -116,11 +116,7 @@ public class HdfsDataSegmentPusher implements DataSegmentPusher
|
||||||
|
|
||||||
// Create parent if it does not exist, recreation is not an error
|
// Create parent if it does not exist, recreation is not an error
|
||||||
fs.mkdirs(outDir.getParent());
|
fs.mkdirs(outDir.getParent());
|
||||||
|
|
||||||
if (!fs.rename(tmpFile.getParent(), outDir)) {
|
if (!fs.rename(tmpFile.getParent(), outDir)) {
|
||||||
if (!fs.delete(tmpFile.getParent(), true)) {
|
|
||||||
log.error("Failed to delete temp directory[%s]", tmpFile.getParent());
|
|
||||||
}
|
|
||||||
if (fs.exists(outDir)) {
|
if (fs.exists(outDir)) {
|
||||||
log.info(
|
log.info(
|
||||||
"Unable to rename temp directory[%s] to segment directory[%s]. It is already pushed by a replica task.",
|
"Unable to rename temp directory[%s] to segment directory[%s]. It is already pushed by a replica task.",
|
||||||
|
@ -135,6 +131,14 @@ public class HdfsDataSegmentPusher implements DataSegmentPusher
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (fs.exists(tmpFile.getParent()) && !fs.delete(tmpFile.getParent(), true)) {
|
||||||
|
log.error("Failed to delete temp directory[%s]", tmpFile.getParent());
|
||||||
|
}
|
||||||
|
} catch(IOException ex) {
|
||||||
|
log.error(ex, "Failed to delete temp directory[%s]", tmpFile.getParent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return dataSegment;
|
return dataSegment;
|
||||||
|
|
Loading…
Reference in New Issue