java driver : lisKeys() returned also deleted keys

Andrea Campolonghi acampolonghi at gmail.com
Sat Nov 20 15:28:32 EST 2010


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


More information about the riak-users mailing list