I am deleting all of the directories for SSTables, etc. between tests.  My goal is for each test to start off with a completely blank-slate Cassandra install.

I can more-or-less get what I want by just keeping the same EmbeddedCassandraSession active through *all* of my unit tests and then just creating and dropping keyspaces every test, but I'd like to know how to totally start over if I'd like to.


Best regards,

On Thu, May 1, 2014 at 2:15 AM, DuyHai Doan <doanduyhai@gmail.com> wrote:
Hello Clint

 Just one question, are you sure that nothing from your code remove the SSTables between tests ? I'm using extensively the same infrastructure than the EmbeddedCassandraService with Achilles and I have no such issue so far


On Wed, Apr 30, 2014 at 8:43 PM, Clint Kelly <clint.kelly@gmail.com> wrote:
Hi all,

I have a unit test framework for a Cassandra project that I'm working on.  For every one of my test classes, I delete all of the data file, commit log, and saved cache locations, start an EmbeddedCassandraService, and populate a keyspace and tables from scratch.

Currently, the unit tests that run in my first test class work fine, but those in my second class die with this error:

    java.io.FileNotFoundException: /Users/clint/work/external-repos/cassandra2-hadoop2/target/cassandra/data/system/local/system-local-jb-5-Data.db (No such file or directory)

This error happens immediately after I call EmbeddedCassandraService.start();

I turned on debugging and traced through the code, and I see this right before the error message:

14/04/30 11:22:47 DEBUG org.apache.cassandra.service.FileCacheService: Evicting cold readers for /Users/clint/work/external-repos/cassandra2-hadoop2/target/cassandra/data/system/local/system-local-jb-5-Data.db

This seems to happen in a callback when a value (in this case, a file reader) is evicted from a Guava cache.

I assume that the problem that I have is something like the following:
  • There is some kind of reading thread associated with target/cassandra/data/system/local/system-local-jb-5-Data.db
  • Even after I stop my EmbeddedCassandraService and blow away all of the data file, commit log, and saved cache locations from my first unit test, the information about the reader for the now-deleted data file still exists.
  • Later when this reference expires in the cache and Cassandra goes to notify the reader, the error occurs because the file no longer exists.

Does anyone have any suggestions on how to deal with this?

Best regards,