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

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


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 ( 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:

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,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list