diff options
author | Harald Musum <musum@yahooinc.com> | 2022-11-14 13:16:17 +0100 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2022-11-14 13:16:17 +0100 |
commit | 9349c2dc70147679bd0fa919f91f0d7fe53f1c97 (patch) | |
tree | e807914811ee8aa9340ef76e5accf4fee9a3e442 /configserver | |
parent | 60e0c807988226eba418e9c80da2fd0b8f5e9015 (diff) |
Change log level and remove setting of last accessed time (not used anymore)
Diffstat (limited to 'configserver')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDirectory.java | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDirectory.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDirectory.java index 7f120a88a05..432d72ac497 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDirectory.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDirectory.java @@ -6,7 +6,6 @@ import com.yahoo.io.IOUtils; import com.yahoo.text.Utf8; import net.jpountz.xxhash.XXHash64; import net.jpountz.xxhash.XXHashFactory; - import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -17,8 +16,6 @@ import java.nio.channels.FileChannel; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.attribute.BasicFileAttributes; -import java.nio.file.attribute.FileTime; -import java.time.Instant; import java.util.logging.Level; import java.util.logging.Logger; @@ -104,7 +101,7 @@ public class FileDirectory { } // If there exists a directory for a file reference, but content does not have correct hash or the file we want to add - // does not exist in the directory, delete it + // does not exist in the directory, delete the directory private void verifyExistingFile(File source, Long hashOfFileToBeAdded) throws IOException { FileReference fileReference = fileReferenceFromHash(hashOfFileToBeAdded); File destinationDir = destinationDir(fileReference); @@ -112,15 +109,10 @@ public class FileDirectory { File existingFile = destinationDir.toPath().resolve(source.getName()).toFile(); if ( ! existingFile.exists() || ! computeHash(existingFile).equals(hashOfFileToBeAdded)) { - log.log(Level.SEVERE, "Directory for file reference '" + fileReference.value() + + log.log(Level.WARNING, "Directory for file reference '" + fileReference.value() + "' has content that does not match its hash, deleting everything in " + destinationDir.getAbsolutePath()); IOUtils.recursiveDeleteDir(destinationDir); - } else { - // Update last access time (used to keep track of when we can delete unused file references - // so update when adding and it already exists) - FileTime fileTime = FileTime.from(Instant.now()); - Files.setAttribute(destinationDir.toPath(), "basic:lastAccessTime", fileTime); } } @@ -132,6 +124,7 @@ public class FileDirectory { return new FileReference(Long.toHexString(hash)); } + // Pre-condition: Destination dir does not exist private FileReference addFile(File source, FileReference reference) { ensureRootExist(); try { |