TL;DR: Distributed databases are spooky, your app must account for
entertaining side effects like you described.

Long form:

There is some window of time between issuing a delete, Riak writing the
initial tombstone, and then Riak deleting the underlying data from disk [1].

In any situation where you're querying for data and there's a chance it
could go away, you need to make sure that you're double checking that the
data is present and that you're accounting for failures.

Secondary indexes ($bucket included) perform a coverage query. That is -
when you query an index, Riak will not read from R partitions (notice that
you can't set an R-value for index reads?), instead it reads from enough
partitions to get 1 copy of the data. See [2] for more details on coverage
queries.

In theory, you could be reading rows from a node before the delete has been
replicated or between the tombstoning and reclamation of the object.

[1]:
http://lists.basho.com/pipermail/riak-users_lists.basho.com/2011-October/006048.html
[2]:
http://lists.basho.com/pipermail/riak-users_lists.basho.com/2011-October/006237.html



---
Jeremiah Peschka - Founder, Brent Ozar Unlimited
MCITP: SQL Server 2008, MVP
Cloudera Certified Developer for Apache Hadoop


On Fri, Aug 30, 2013 at 5:54 AM, Anders Hedström <[email protected]
> wrote:

> Hello,
>
> I've got a riak cluster with 3 nodes.
>
> I use the $bucket index to get all keys for a bucket. Then I loop thru the
> returned list and try to fetch each object for each key. For some keys that
> was returned I get a 404 back when trying to fetch the object... How is
> this possible? What can have gone wrong? I've got no clue... When the
> $bucket index returns a key I expect it to exist.
>
> I appreciate any response...
>
> Cheers
> //Anders
>
>
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to