You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jm...@apache.org on 2015/09/03 18:45:02 UTC

[2/5] cassandra git commit: Fix SSTableLoaderTest on Windows

Fix SSTableLoaderTest on Windows

Patch by pmotta; reviewed by jmckenzie for CASSANDRA-10210


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/66b0e1d7
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/66b0e1d7
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/66b0e1d7

Branch: refs/heads/trunk
Commit: 66b0e1d7889d0858753c6e364e77d86fe278eee4
Parents: 6a86d22
Author: Paulo Motta <pa...@gmail.com>
Authored: Wed Sep 2 14:20:00 2015 -0400
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Wed Sep 2 14:20:00 2015 -0400

----------------------------------------------------------------------
 .../cassandra/io/sstable/SSTableLoaderTest.java       | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/66b0e1d7/test/unit/org/apache/cassandra/io/sstable/SSTableLoaderTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableLoaderTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableLoaderTest.java
index 3370e56..4eebdeb 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableLoaderTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableLoaderTest.java
@@ -38,6 +38,7 @@ import org.apache.cassandra.db.partitions.*;
 import org.apache.cassandra.db.marshal.AsciiType;
 import org.apache.cassandra.dht.Range;
 import org.apache.cassandra.dht.Token;
+import org.apache.cassandra.io.FSWriteError;
 import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.schema.KeyspaceParams;
 import org.apache.cassandra.service.StorageService;
@@ -80,7 +81,18 @@ public class SSTableLoaderTest
     @After
     public void cleanup()
     {
-        FileUtils.deleteRecursive(tmpdir);
+        try {
+            FileUtils.deleteRecursive(tmpdir);
+        } catch (FSWriteError e) {
+            /**
+             * Windows does not allow a mapped file to be deleted, so we probably forgot to clean the buffers somewhere.
+             * We force a GC here to force buffer deallocation, and then try deleting the directory again.
+             * For more information, see: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4715154
+             * If this is not the problem, the exception will be rethrown anyway.
+             */
+            System.gc();
+            FileUtils.deleteRecursive(tmpdir);
+        }
     }
 
     private static final class TestClient extends SSTableLoader.Client