Search code examples
riak

What Happens to Riak Links When One Object is Deleted?


In Riak, if a link is created from object A to object B, and object B is then deleted, what happens to the link stored in the metadata of object A? Must the link be manually deleted? Or is it automatically deleted?


Solution

  • They must be manually deleted.

    A link is just a metadata entry and there is nothing stopping you from creating a link with a target that doesn't exist, so a missing link target is not explicitly an error.

    Links are one-way. When operating on object B there is no way to determine that object A contains a link to object B, so Riak does not provide an automated method for an operation on object B to trigger an update to object A.
    If there is some way to divine which objects may contain links, your application code would need to handle updating the links.