Fwd: Re: Delete all entries in a bucket?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Re: Delete all entries in a bucket?

Sean Cribbs
Reposting to the list.

-------- Original Message --------
Subject: Re: Delete all entries in a bucket?
Date: Mon, 22 Feb 2010 15:19:57 -0700
From: Sean Cribbs [hidden email]
To: Dan Young [hidden email]


Dan,

With ripple, you can do something like this:

client = Riak::Client.new
bucket = client['my_bucket']
bucket.keys.each {|k| Riak::RObject.new(bucket, k).delete }

You could also pass that block to the 'keys' method on the bucket, 
assuming you're not using the CurbBackend, which has some problems with 
concurrency and curl-handle corruption.  Obviously this is not something 
you want to do very often because it's expensive (N+1).

Sean

On 2/21/10 4:43 PM, Dan Young wrote:
> Hello all,
> I'm a newbie to Riak and am playing around with porting a mongodb
> application to riak. Is there (I'm sure there is) a way to either
> delete all the objects in a bucket or delete an entire bucket  and all
> contained objects?  I'm using Ruby....
>
> Regards,
>
> Dan
>
> _______________________________________________
> riak-users mailing list
> [hidden email]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>    


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Re: Delete all entries in a bucket?

Mårten Gustafson
> -------- Original Message --------
> Subject: Re: Delete all entries in a bucket?
> Date: Mon, 22 Feb 2010 15:19:57 -0700
> From: Sean Cribbs <[hidden email]>
> To: Dan Young <[hidden email]>
>
> Dan,
>
[snip-out-ripple-stuff]
>
> You could also pass that block to the 'keys' method on the bucket,
> assuming you're not using the CurbBackend, which has some problems with
> concurrency and curl-handle corruption.  Obviously this is not something
> you want to do very often because it's expensive (N+1).

Any thoughts on supporting DELETE on the bucket url to empty the bucket?



/mårten.

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Re: Delete all entries in a bucket?

francisco treacy-2
+1 to Mårten's question.

Francisco

2010/3/9 Mårten Gustafson <[hidden email]>:

>> -------- Original Message --------
>> Subject: Re: Delete all entries in a bucket?
>> Date: Mon, 22 Feb 2010 15:19:57 -0700
>> From: Sean Cribbs <[hidden email]>
>> To: Dan Young <[hidden email]>
>>
>> Dan,
>>
> [snip-out-ripple-stuff]
>>
>> You could also pass that block to the 'keys' method on the bucket,
>> assuming you're not using the CurbBackend, which has some problems with
>> concurrency and curl-handle corruption.  Obviously this is not something
>> you want to do very often because it's expensive (N+1).
>
> Any thoughts on supporting DELETE on the bucket url to empty the bucket?
>
>
>
> /mårten.
>
> _______________________________________________
> riak-users mailing list
> [hidden email]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Delete all entries in a bucket?

francisco treacy-2
Yeah I know, that's my code :p

2010/3/9 Alexander Sicular <[hidden email]>:

> I don't think there is a bucket delete operation. generally i've done such things by listing the keys in a bucket and deleting them individually. something along the lines of the cleanup process at the bottom of this script:
>
> http://github.com/frank06/riak-js/blob/master/test/airport-test.js
>
> -Alexander
>
> On Mar 9, 2010, at 1:52 PM, francisco treacy wrote:
>
>> +1 to Mårten's question.
>>
>> Francisco
>>
>> 2010/3/9 Mårten Gustafson <[hidden email]>:
>>>> -------- Original Message --------
>>>> Subject: Re: Delete all entries in a bucket?
>>>> Date: Mon, 22 Feb 2010 15:19:57 -0700
>>>> From: Sean Cribbs <[hidden email]>
>>>> To: Dan Young <[hidden email]>
>>>>
>>>> Dan,
>>>>
>>> [snip-out-ripple-stuff]
>>>>
>>>> You could also pass that block to the 'keys' method on the bucket,
>>>> assuming you're not using the CurbBackend, which has some problems with
>>>> concurrency and curl-handle corruption.  Obviously this is not something
>>>> you want to do very often because it's expensive (N+1).
>>>
>>> Any thoughts on supporting DELETE on the bucket url to empty the bucket?
>>>
>>>
>>>
>>> /mårten.
>>>
>>> _______________________________________________
>>> riak-users mailing list
>>> [hidden email]
>>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>>
>>
>> _______________________________________________
>> riak-users mailing list
>> [hidden email]
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Delete all entries in a bucket?

Alexander Sicular
In reply to this post by francisco treacy-2
I don't think there is a bucket delete operation. generally i've done such things by listing the keys in a bucket and deleting them individually. something along the lines of the cleanup process at the bottom of this script:

http://github.com/frank06/riak-js/blob/master/test/airport-test.js

-Alexander

On Mar 9, 2010, at 1:52 PM, francisco treacy wrote:

> +1 to Mårten's question.
>
> Francisco
>
> 2010/3/9 Mårten Gustafson <[hidden email]>:
>>> -------- Original Message --------
>>> Subject: Re: Delete all entries in a bucket?
>>> Date: Mon, 22 Feb 2010 15:19:57 -0700
>>> From: Sean Cribbs <[hidden email]>
>>> To: Dan Young <[hidden email]>
>>>
>>> Dan,
>>>
>> [snip-out-ripple-stuff]
>>>
>>> You could also pass that block to the 'keys' method on the bucket,
>>> assuming you're not using the CurbBackend, which has some problems with
>>> concurrency and curl-handle corruption.  Obviously this is not something
>>> you want to do very often because it's expensive (N+1).
>>
>> Any thoughts on supporting DELETE on the bucket url to empty the bucket?
>>
>>
>>
>> /mårten.
>>
>> _______________________________________________
>> riak-users mailing list
>> [hidden email]
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>
> _______________________________________________
> riak-users mailing list
> [hidden email]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com