AuthZed is 5 - The Authorization Infrast...
# spicedb
d
Hi all, I got a question related to solve the dual write problem with spicedb. In your docs and the Blogpost you mention the solution Two rights commit: https://authzed.com/blog/writing-relationships-to-spicedb#two-writes--commit This solution looks straight forward but watching https://www.youtube.com/live/uz_gxz3whS0?t=2172&is=oWxHZN5DVhR0DZU9 This video out of https://authzed.com/blog/the-dual-write-problem-in-spicedb-a-deep-dive-from-google-and-canva-experience it seems that it is not a solution at all? Sadly it is not really stated why in the video. Can someone help out here? Is 2pc a valid/robust solution or not?
y
this is the important part: > If the database transaction fails to commit, the relationship will existing in SpiceDB, but there will be no objects for it in the relational database - in many schemas, this means that the relationship in SpiceDB is likely "superfluous", never being used in a CheckPermission, and therefore safe to have around (minus some extra space being taken up) the idea in the quoted text is that for most relationships, which are usually a part of a "positive" permission, if the application transaction fails and there's an extra SpiceDB relationship, it's often not an issue to have an orphaned relationship. there are places where it could be a problem: * if the extra relationship is part of a negative permission, it could result in someone losing access to something they should still have access to, at least according to your application database * a stale relationship could result in a user later having access to something they shouldn't * a stale relationship in the middle of a permission chain (say group to user, or group to organization) could result in a user having access to things that they shouldn't, at least according to your application database. it's still a data inconsistency. i'd personally be wary of using this approach in my own application. we also talk a little bit about it [here](https://authzed.com/blog/the-dual-write-problem#what-is-the-dual-write-problem).
d
Thanks for the detailed explanation. Helps me in sorting out the correct design.
y
sure thing!
17 Views