basho / riak-erlang-client

The Riak client for Erlang.
Apache License 2.0
311 stars 188 forks source link

Delete items in Set with Context [JIRA: CLIENTS-755] #260

Open cjimison opened 8 years ago

cjimison commented 8 years ago

Sorry if this is more of a question then a bug, but I am a little stuck. Recently I updated my riak-erlang-client and I see that in the riakc_set:del_element I need to have a context set or it will throw context_required (riakc_map as well).

However I am confused by this because the basho docs says:

%% You cannot fetch a Data Type's context directly using the Erlang %% client. This is actually quite all right, as the client automatically %% manages contexts when making updates.

Does del_element not fall into the confines of an "update"?

Assuming that del_element is a special case:

I have a very large set in the DB (about 1M entries) and I was hoping to be able to delete an element in that set without reading the whole set first. I tried to read just the head of the object but as per what the doc said, I can't seem to get the context unless I read the whole set into my server.

I don't read this list very often but elements are added/removed on a somewhat frequent bases.

Thanks for any info/help!

cjimison commented 8 years ago

So the docs also say that "removing an element from a set is a bit trickier than adding elements. In order to remove an item (or multiple items), we need to first fetch the set, which provides our client access to the set's causal context". So to answer my own question yes delete is a special case :p

However the question I still have is can I ask Riak for just the context without pulling the whole set down? Given the amount of stuff in this list it would be nice not to put the extra load on the nic and more stuff to GC if I am not actually using the rest of the set except to remove an element from it.

Thanks!