diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-12-29 10:29:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-29 10:29:03 +0100 |
commit | b1b07466d91a6d4739fd7b36ca931b7ffe75f191 (patch) | |
tree | dcdd0736b8c45c970e160aca23c340782ee079c6 | |
parent | 6afc44c61d16fbd2e89b1d28c7f50c4f00fdcd0f (diff) | |
parent | 14e73bc51d341fe48774a91f11513f066ad39190 (diff) |
Merge pull request #4528 from vespa-engine/hmusum/delete-file-if-writing-fails
Delete inprogress file if write is not successful
-rw-r--r-- | filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java | 3 |
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; |