Repository: cassandra Updated Branches: refs/heads/trunk f66730d61 -> 966bea74b
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/966bea74 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/966bea74 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/966bea74 Branch: refs/heads/trunk Commit: 966bea74bd031f92f953fa66bb1d6da3867b06b9 Parents: f66730d Author: Paulo Motta <pauloricard...@gmail.com> Authored: Wed Sep 2 14:20:00 2015 -0400 Committer: Joshua McKenzie <jmcken...@apache.org> Committed: Wed Sep 2 14:21:03 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/966bea74/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