I have same problem and deleted the target file with the similar way as Miao said.
protected void commitFile(JobContext job, Path source, Path target) throws IOException {
log.info(String.format("Moving %s to %s", source, target));
if (!FileSystem.get(job.getConfiguration()).rename(source, target)) {
log.error(String.format("Failed to move from %s to %s", source, target));
FileStatus targetFileStatus = FileSystem.get(job.getConfiguration()).getFileStatus(target);
if (targetFileStatus.isFile()) {
FileStatus sourceFileStatus = FileSystem.get(job.getConfiguration()).getFileStatus(source);
log.warn("Failed to move : sourceFile (" + sourceFileStatus.getLen() +"), targetFile (" + targetFileStatus.getLen() +
") " + " length equals = " + (sourceFileStatus.getLen() == targetFileStatus.getLen()));
if (FileSystem.get(job.getConfiguration()).delete(target)) {
log.warn("Failed to move : retry move : " + FileSystem.get(job.getConfiguration()).rename(source, target));
}
} else {
throw new IOException(String.format("Failed to move from %s to %s", source, target));
}
}
}
-----------------------------------
2015년 9월 30일 수요일 오후 6시 17분 46초 UTC+9, Zhao Weinan 님의 말: