The best (fastest) way to delete/clear a bucket [python]

Paweł Królikowski rabbbit at gmail.com
Mon May 19 08:53:23 EDT 2014


Hi,

For testing, I'd like to be able to throw a large number of data at Riak
(100k+ entries), check how it performed, change something in the
application, run the test again. I'd like to use the same data every time,
so, I'd like to clear the bucket between every test.

The documentation (
http://docs.basho.com/riak/2.0.0beta1/dev/references/http/) says:

*Delete Buckets*
There is no straightforward way to delete an entire Bucket. To delete all
the keys in a bucket, you’ll need to delete them all individually.


So, I'm currently using something like:

for k in r_bk.get_keys():
v = r_bk.get(k)
 if v.exists:
r_bk.delete(v)

The problem is that r_bk.get_keys() returns a lot of elements that don't
exist (tombstones?) and iterating over all of them takes time.

Is that the way it's supposed to work? Or am I missing something?

- I'm using default delete_mode configuration ( 3 seconds )
- I'm using Riak 2.0 alpha 19 with Python. ( there's a bug with strong
consistency in Beta1, cannot use it)
- changing the bucket name for every run seems .. impractical?

Any advices welcomed,

--
Thanks,
Paweł
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20140519/c6ec67f3/attachment.html>


More information about the riak-users mailing list