incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Fixed BLUR-437
Date Thu, 18 Jun 2015 13:52:05 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master ef53f55f7 -> 2225c8e59


Fixed BLUR-437


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/2225c8e5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/2225c8e5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/2225c8e5

Branch: refs/heads/master
Commit: 2225c8e591763d4e01859e0c9b14cb9034e4a7ed
Parents: ef53f55
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Thu Jun 18 09:52:06 2015 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Thu Jun 18 09:52:06 2015 -0400

----------------------------------------------------------------------
 .../manager/writer/SnapshotIndexDeletionPolicy.java    | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/2225c8e5/blur-core/src/main/java/org/apache/blur/manager/writer/SnapshotIndexDeletionPolicy.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/SnapshotIndexDeletionPolicy.java
b/blur-core/src/main/java/org/apache/blur/manager/writer/SnapshotIndexDeletionPolicy.java
index 4dd143c..30690e5 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/writer/SnapshotIndexDeletionPolicy.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/writer/SnapshotIndexDeletionPolicy.java
@@ -101,11 +101,13 @@ public class SnapshotIndexDeletionPolicy extends IndexDeletionPolicy
{
     }
     writer.close();
     outputStream.close();
-    cleanupOldFiles();
+    cleanupOldFiles(fileSystem, existing);
   }
 
-  private void cleanupOldFiles() {
-
+  private void cleanupOldFiles(FileSystem fileSystem, SortedSet<FileStatus> existing)
throws IOException {
+    for (FileStatus fileStatus : existing) {
+      fileSystem.delete(fileStatus.getPath(), false);
+    }
   }
 
   private String buffer(long number) {
@@ -140,7 +142,8 @@ public class SnapshotIndexDeletionPolicy extends IndexDeletionPolicy {
       names.add(name);
     }
     reader.close();
-    cleanupOldFiles();
+    existing.remove(last);
+    cleanupOldFiles(fileSystem, existing);
   }
 
   public void createSnapshot(String name, DirectoryReader reader, String context) throws
IOException {
@@ -183,7 +186,7 @@ public class SnapshotIndexDeletionPolicy extends IndexDeletionPolicy {
   public Path getSnapshotsDirectoryPath() {
     return _path;
   }
-  
+
   public Long getGeneration(String name) {
     return _namesToGenerations.get(name);
   }


Mime
View raw message