java driver : lisKeys() returned also deleted keys

Jon Brisbin jon at jbrisbin.com
Sat Nov 20 23:03:36 EST 2010


FWIW- I've been working on Riak support for the spring-data project, which is Spring's NoSQL abstraction that will support a whole slew of NoSQL databases. I'm using it as the basis for the Grails Gorm support for Riak, which I'm also writing. It has support for getting and setting POJOs and whatnot using the Jackson JSON mapper. I've also included a fairly basic Map/Reduce abstraction.

This uses the Spring 3.0 RestTemplate abstraction rather than relying on a specific driver. It also uses the built-in conversion support for reading and writing JSON data and other types supported by the Spring 3.0.5 conversion mechanism.

I see you're using the PB driver, so none of this might apply to your case (we've talked about a good way to support both the REST API and the PB API in the same codebase but haven't decided on the best way to do that, if at all). It seems to be pretty easy to use and with the built-in support for ETag caching, it does make a difference in app performance.

https://github.com/SpringSource/spring-data-keyvalue


Thanks!

J. Brisbin
http://jbrisbin.com/


On Nov 20, 2010, at 2:28 PM, Andrea Campolonghi wrote:

> Andy,
> 
> I am testing but the issue is that Riak really miss a valid java driver.
> The one I am using is fine but has great issue of memory leaks ... sometimes driver hangs ( riak is not even getting the connection ).
> 
> I will restart my server test and try again ....
> 
> Andrea
> 
> 2010/11/20 Andrea Campolonghi <acampolonghi at gmail.com>
> Andy,
> 
> great to know.
> So you know is there a way to get if this marker?
> 
> Andrea
> 
> 2010/11/20 Andy Gross <andy at basho.com>
> 
> 
> Hi Andrea,
> 
> Key deletion in Riak doesn't occur immediately in Riak - keys are first marked with a tombstone marker and then reaped asynchronously.   If you insert a sleep between the delete() and keys() calls (try a few seconds) - does the test pass?
> 
> - Andy
> 
> 
> On Sat, Nov 20, 2010 at 10:02 AM, Andrea Campolonghi <acampolonghi at gmail.com> wrote:
> I am having this issues with the java driver :
> https://github.com/krestenkrab/riak-java-pb-client
> 
> After deleting a key the listKeys method still return it.
> The following test case put and delete one simple key and fails when counting the listKeys item.
> 
> Any Suggestion?
> 
> public class RiakCacheTest extends TestCase {
> 
> 
> private RiakClient rc;
> 
> private String host = "172.16.194.134";
> 
> private int port = 8087;
> 
> private String bucket = "bucket";
> 
> 
> 
> @Override
> 
> protected void setUp() throws Exception {
> 
> rc = new RiakClient(this.host,this.port);
> 
> rc.setClientID(this.getClass().toString());
> 
> }
> 
> 
> 
> public void testRemove(){
> 
> String key = "key";
> 
> String value = "Andrea";
> 
> 
> RiakObject obj = new RiakObject(this.bucket, key, value);
> 
> 
> try{
> 
> this.rc.store(obj);
> 
> assertTrue(getValue(key).equals(value));
> 
> assertEquals(keys().size(),1);
> 
> 
> this.rc.delete(this.bucket, key);
> 
> assertNull(getValue(key));
> 
> assertEquals(keys().size(),0);
> 
> 
> }catch(IOException e){
> 
> e.printStackTrace();
> 
> }
> 
> 
> }
> 
> 
> private String getValue(String key){
> 
> String fetched = "";
> 
> try{
> 
> RiakObject[] ros = this.rc.fetch(this.bucket, key);
> 
> for(RiakObject ro : ros){
> 
> return ro.getValue().toStringUtf8();
> 
> }
> 
> }catch(IOException e){
> 
> e.printStackTrace();
> 
> }
> 
> return null;
> 
> }
> 
> 
> 
> private List keys() {
> 
> ArrayList<String> result = new ArrayList<String>();
> 
> ByteString bucket = ByteString.copyFromUtf8(this.bucket);
> 
> 
> try{
> 
> KeySource keys = this.rc.listKeys(bucket);
> 
> while(keys.hasNext()){
> 
> String key = keys.next().toStringUtf8();
> 
> result.add(key);
> 
> }	  
> 
> }catch(IOException e){
> 
> e.printStackTrace();
> 
> }
> 
> return result;
> 
> }
> 
> 
> 
> }
> 
> 
> -- 
> Andrea Campolonghi
> 
> Cell : +39 347 2298435
> acampolonghi at gmail.com
> andrea at andreacfm.com
> http://www.andreacfm.com
> 
> Railo Team
> andrea at getrailo.org
> http://getrailo.org
> 
> 
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> 
> 
> 
> 
> 
> 
> 
> -- 
> Andrea Campolonghi
> 
> Cell : +39 347 2298435
> acampolonghi at gmail.com
> andrea at andreacfm.com
> http://www.andreacfm.com
> 
> Railo Team
> andrea at getrailo.org
> http://getrailo.org
> 
> 
> 
> 
> 
> -- 
> Andrea Campolonghi
> 
> Cell : +39 347 2298435
> acampolonghi at gmail.com
> andrea at andreacfm.com
> http://www.andreacfm.com
> 
> Railo Team
> andrea at getrailo.org
> http://getrailo.org
> 
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20101120/7d2a5289/attachment.html>


More information about the riak-users mailing list