summaryrefslogtreecommitdiffstats
path: root/filedistribution
diff options
context:
space:
mode:
authorHarald Musum <musum@oath.com>2017-12-29 09:44:37 +0100
committerHarald Musum <musum@oath.com>2017-12-29 09:44:37 +0100
commit14e73bc51d341fe48774a91f11513f066ad39190 (patch)
treeb2c2214d06d4191f550fd32f7914f06a41ad9d5b /filedistribution
parent72bb066cd5d25a2f1c395804e975dd9d1d0850d3 (diff)
Delete inprogress file if write is not successful
Write appends, so if it fails we should clean up, else we will use more and more disk space
Diffstat (limited to 'filedistribution')
-rw-r--r--filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java
index 70f22296bc1..c2825528f7e 100644
--- a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java
+++ b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java
@@ -103,6 +103,7 @@ public class FileReceiver {
Files.write(inprogressFile.toPath(), part, StandardOpenOption.WRITE, StandardOpenOption.APPEND);
} catch (IOException e) {
log.log(LogLevel.ERROR, "Failed writing to file(" + inprogressFile.toPath() + "): " + e.getMessage(), e);
+ inprogressFile.delete();
throw new RuntimeException("Failed writing to file(" + inprogressFile.toPath() + "): ", e);
}
currentFileSize += part.length;
@@ -295,7 +296,7 @@ public class FileReceiver {
try {
session.addPart(partId, part);
} catch (Exception e) {
- log.severe("Got exception + " + e);
+ log.severe("Got exception " + e);
retval = 1;
}
double completeness = (double) session.currentFileSize / (double) session.fileSize;