CorrugatedIron call to delete a bucket.

Kevin Burton rkevinburton at charter.net
Wed Feb 6 10:07:52 EST 2013


So it sounds like if there is the possibility of deleting buckets I need to
learn LevelDB or Erlang. It sounds like you are leaning towards the former.

 

From: Jeremiah Peschka [mailto:jeremiah.peschka at gmail.com] 
Sent: Wednesday, February 06, 2013 8:56 AM
To: Kevin Burton; riak-users at lists.basho.com
Subject: Re: CorrugatedIron call to delete a bucket.

 

Don't be too put out - deleting a bucket is the sad panda story of Riak. We
provide the DeleteBucket() method largely for our own selfish purposes of
cleaning up after unit tests.

 

2i is a secondary index. If you've set up Riak to use the LevelDB back end,
you can create secondary indices. There is a $keys index that just lists the
names of the keys in a bucket. By using secondary indices, you can stream
the $keys index back to CorrugatedIron and then issue async deletes on
chunks of keys.

 

The Erlang way is a bit more complex - it requires knowing Erlang. In
theory, you can write several Erlang functions that will perform a MapReduce
across your bucket (or even the secondary index) and delete keys. The upside
of using Erlang + MapReduce to do it is that you won't have to round trip
between Riak and your client. The downside is that you have to learn Erlang.
;)

 

 

 




---

Jeremiah Peschka - Founder, Brent Ozar Unlimited

MCITP: SQL Server 2008, MVP

Cloudera Certified Developer for Apache Hadoop

 

On Wed, Feb 6, 2013 at 4:56 AM, Kevin Burton <rkevinburton at charter.net>
wrote:

Sorry. Being a beginner I am not aware of "alternative" methods. I have not
read enough to use Erlang. I don't know what "querying a 2i" is. I also
wasn't aware that I needed to manage my keys. Perhaps this question could
turn into a kind of poll for best practices? All suggestions are greatly
appreciated.


On Feb 6, 2013, at 6:44 AM, OJ Reeves <oj at buffered.io> wrote:

Kevin,

 

No I'm not saying that bucket's can't be deleted. I'm saying that you should
choose an alternative method. For example, manage your keys in another way
perhaps by querying a 2i and using the result to delete the values. This
could be done via an Erlang map reduce job. You could store the keys
elsewhere for later retrieval then delete each object via the key.

 

The problem here isn't deleting buckets, the problem is listing keys. I do
think that other Riak users, Basho people in particular, would be better
positioned to offer alternative approaches than me.

 

OJ

 

On Wed, Feb 6, 2013 at 10:37 PM, Kevin Burton <rkevinburton at charter.net>
wrote:

I see the warning and I would love to heed it. You are saying buckets can
never be deleted? Rename has the same problem?


On Feb 6, 2013, at 6:15 AM, OJ Reeves <oj at buffered.io> wrote:

Deleting a bucket takes forever in any Riak client if the bucket has a lot
of values in it. This is because a bucket isn't an object that is any way
analogous to a "table" like you'd see in an RDBMS and to delete a bucket the
keys in that bucket need to be listed first (please correct me if I'm wrong
people!). This operation is known to be slow and using it is not
recommended.

 

CorrugatedIron outputs warning messages to the debug console whenever
ListKeys or DeleteBucket are called. I'd recommend heeding those warnings
and look to take a different approach.

 

OJ

 

On Wed, Feb 6, 2013 at 8:11 AM, Jeremiah Peschka
<jeremiah.peschka at gmail.com> wrote:

No.

 

Deleting a bucket requires deleting all keys in the bucket. It will be slow.




---

Jeremiah Peschka - Founder, Brent Ozar Unlimited

MCITP: SQL Server 2008, MVP

Cloudera Certified Developer for Apache Hadoop

 

On Tue, Feb 5, 2013 at 1:58 PM, Kevin Burton <rkevinburton at charter.net>
wrote:

 

I am trying to remove a bucket. So I call client.DeleteBucket(<my bucket>)
but this takes *forever*. Is there a faster way to simply remove a bucket?

 

 

 

_______________________________________________
riak-users mailing list
riak-users at lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

 


_______________________________________________
riak-users mailing list
riak-users at lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com





 

-- 

OJ Reeves

+61 431 952 586 <tel:%2B61%20431%20952%20586> 
http://buffered.io/





 

-- 

OJ Reeves

+61 431 952 586 <tel:%2B61%20431%20952%20586> 
http://buffered.io/


_______________________________________________
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/20130206/b5193f30/attachment.html>


More information about the riak-users mailing list