summaryrefslogtreecommitdiffstats
path: root/filedistribution
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-10-05 15:19:45 +0200
committerHarald Musum <musum@verizonmedia.com>2020-10-05 15:19:45 +0200
commit46c67bb78209add1586b488da041a8f762926c5a (patch)
tree5f2db849b8c97c159660a3ff12dcbe175e918a9a /filedistribution
parent83df87bf1ace88517ab6858e5c0a8c45ce7ad5ce (diff)
Log at lower level when moving file and file already exists
No need to log at info level, this is not a filure and will happen occasionally. Also minor change so that we log if deleting a file fails.
Diffstat (limited to 'filedistribution')
-rw-r--r--filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java13
1 files changed, 8 insertions, 5 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 73c289b7d51..30c1d7cd673 100644
--- a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java
+++ b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java
@@ -56,7 +56,7 @@ public class FileReceiver {
private final long fileSize;
private long currentFileSize;
private long currentPartId;
- private long currentHash;
+ private final long currentHash;
private final File fileReferenceDir;
private final File tmpDir;
private final File inprogressFile;
@@ -96,9 +96,12 @@ public class FileReceiver {
try {
Files.write(inprogressFile.toPath(), part, StandardOpenOption.WRITE, StandardOpenOption.APPEND);
} catch (IOException e) {
- log.log(Level.SEVERE, "Failed writing to file (" + inprogressFile.toPath() + "): " + e.getMessage(), e);
- inprogressFile.delete();
- throw new RuntimeException("Failed writing to file (" + inprogressFile.toPath() + "): ", e);
+ String message = "Failed writing to file (" + inprogressFile.toPath() + "): ";
+ log.log(Level.SEVERE, message + e.getMessage(), e);
+ boolean successfulDelete = inprogressFile.delete();
+ if ( ! successfulDelete)
+ log.log(Level.INFO, "Unable to delete " + inprogressFile.toPath());
+ throw new RuntimeException(message, e);
}
currentFileSize += part.length;
currentPartId++;
@@ -192,7 +195,7 @@ public class FileReceiver {
} catch (FileAlreadyExistsException e) {
// Don't fail if it already exists (we might get the file from several config servers when retrying, servers are down etc.
// so it might be written already). Delete temp file/dir in that case, to avoid filling the disk.
- log.log(Level.INFO, "Failed moving file '" + tempFile.getAbsolutePath() + "' to '" + destination.getAbsolutePath() +
+ log.log(Level.FINE, "Failed moving file '" + tempFile.getAbsolutePath() + "' to '" + destination.getAbsolutePath() +
"', '" + destination.getAbsolutePath() + "' already exists");
deleteFileOrDirectory(tempFile);
} catch (IOException e) {