[infinispan-dev] CassandraCacheStore

Manik Surtani manik at jboss.org
Tue Sep 14 07:16:30 EDT 2010


Nice one Tristan!  Would love to take a look at the code at some point.  My comments in line.


On 8 Sep 2010, at 11:03, Tristan Tarrant wrote:

> Dear all,
> 
> I am new here and I (would like to) bring gifts :)
> 
> First of all thanks for the great work you have been doing on Infinispan. I was introduced to Infinispan by Sanne, with whom I have collaborated in the past (hi Sanne!).
> 
> Over the last few days I have been writing a CacheStore implementation for Apache Cassandra, but I have a few unanswered questions I would like to submit to you before I proceed.
> 
> I have written my code by taking inspiration from other CacheStore providers, namely the JDBM and Hibernate stores.
> 
> I hash the key of an entry to produce an appropriate key for Cassandra. I then store the marshalled value in a Column named "entry" within a ColumnFamily named "Infinispan". If the entry has an expiration I create another Column within the "Infinispan" ColumnFamily using the following pattern: "expiration"+"0paddedtimestamp" containg a placeholder value.
> When purgeInternal is invoked I delete all rows which have a column in the range "Infinispan:expiration0000000000000000" to "Infinispan:expiration0paddednowtimestamp".

Is this efficient from a Cassandra perspective?  Would this not involve a lot of String comparisons?

> I have noticed that the JDBM CacheStore keeps expiration entries in an internal LinkedHashMap: is that just for performance reasons ?
> Also, Cassandra doesn't support transactional operations, but merely batched operations: within the applyModifications() method I just send all operations in one batch invocation. Is this ok ? I guess that Infinispan manages the transactional side of things.

Yes Infinispan takes care of transactional atomicity.

> I am currently developing in my own private Subversion repository and using my own package name and Junit+mockito in place of testng+easymock. Would such an object be worthy of potential inclusion within Infinispan itself (and so should I refactor everything around the org.infinispan package and integrate nicely with the rest of the tree?). Should I submit a patch to the current Infinispan trunk ?

If you want to include this in Infinispan, I recommend switching your test framework to TestNG + EasyMock.  You should also refer to the unit test guidelines for Infinispan, as we use a highly multithreaded parallel testing environment and your tests need to play nice with this framework.  Details here:

http://community.jboss.org/wiki/InfinispanQuickStartGuideforDevelopers
http://community.jboss.org/wiki/ParallelTestSuite

If you do wish to include this in Infinispan, we'd need you to 

1) Sign the contributor agreement
2) Package the maven module under cachestores/ (similar to the way the JDBM cache store is packaged)
3) Send us a ZIP file containing the module for us to review before we give you commit access to commit the module
4) Document the new CacheStore here:

http://community.jboss.org/docs/DOC-14893?uniqueTitle=false

Cheers
Manik
--
Manik Surtani
manik at jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org







More information about the infinispan-dev mailing list