You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2016/04/06 17:37:57 UTC
nifi git commit: NIFI-1726: Addressed issue where we can run into an
infinite loop if we are expiring data based on a timestamp instead of disk
space usage and we have a file whose timestamp is exactly equal to our
threshold for deletion
Repository: nifi
Updated Branches:
refs/heads/master b0cc6ae7e -> 84b1c60d5
NIFI-1726: Addressed issue where we can run into an infinite loop if we are expiring data based on a timestamp instead of disk space usage and we have a file whose timestamp is exactly equal to our threshold for deletion
Signed-off-by: joewitt <jo...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/84b1c60d
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/84b1c60d
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/84b1c60d
Branch: refs/heads/master
Commit: 84b1c60d541081bbff1eb1a6275adbf886cec26b
Parents: b0cc6ae
Author: Mark Payne <ma...@hotmail.com>
Authored: Tue Apr 5 16:41:56 2016 -0400
Committer: joewitt <jo...@apache.org>
Committed: Wed Apr 6 11:27:53 2016 -0400
----------------------------------------------------------------------
.../nifi/controller/repository/FileSystemRepository.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/84b1c60d/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
index 9fec793..497e630 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
@@ -1196,7 +1196,7 @@ public class FileSystemRepository implements ContentRepository {
private long destroyExpiredArchives(final String containerName, final Path container) throws IOException {
archiveExpirationLog.debug("Destroying Expired Archives for Container {}", containerName);
final List<ArchiveInfo> notYetExceedingThreshold = new ArrayList<>();
- final long removalTimeThreshold = System.currentTimeMillis() - maxArchiveMillis;
+ long removalTimeThreshold = System.currentTimeMillis() - maxArchiveMillis;
long oldestArchiveDateFound = System.currentTimeMillis();
// determine how much space we must have in order to stop deleting old data
@@ -1230,6 +1230,8 @@ public class FileSystemRepository implements ContentRepository {
try {
final long fileSize = toDelete.getSize();
+ removalTimeThreshold = System.currentTimeMillis() - maxArchiveMillis;
+
// we use fileQueue.peek above instead of fileQueue.poll() because we don't always want to
// remove the head of the queue. Instead, we want to remove it only if we plan to delete it.
// In order to accomplish this, we just peek at the head and check if it should be deleted.
@@ -1287,6 +1289,7 @@ public class FileSystemRepository implements ContentRepository {
}
try {
+ final long timestampThreshold = removalTimeThreshold;
Files.walkFileTree(archive, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
@@ -1295,7 +1298,7 @@ public class FileSystemRepository implements ContentRepository {
}
final long lastModTime = getLastModTime(file);
- if (lastModTime < removalTimeThreshold) {
+ if (lastModTime < timestampThreshold) {
try {
Files.deleteIfExists(file);
containerState.decrementArchiveCount();