I was wondering how Solid Servers handle conflict resolution. For instance, if I have a resource where multiple agents can write to the same resource and they both update a specific field in a Thing, how is the conflict handled internally? Are the requests just processed in the order they are received? Is there a standard regarding this or is it up to the server?
I think the short answer is that it is up to the server, likely handling them one after each other.
But there are some relevant considerations:
It’s very unlikely that the server handles two requests for the same resource at the exact same time. The problematic flow is likely: user A fetches the document. user B fetches the document. Both update a value client-side. user A overwrites the document. user B overwrites the document. The changes of A are lost, overwritten by B.
if you use n3 patches (see section 5.3.1) instead of PUT requests, you only send the changes to the document. If the changes are independent, they will both succeed and remain in the final version.
You can use headers such as If-Unmodified-Since and If-None-Match to tell the server to reject requests if the resource changed in the meantime. With the example 1, the overwrite of B would be rejected. However, I don’t think servers are required to honor these headers.
You could consider CRDTs. There’s been some discussion on this forum that you can find by searching for “CRDT”.
I hope this helps, feel free to ask for clarification on any of these points
Thanks, I figured that 1. was the case. As far as 3 goes, I believe you’re right that servers aren’t required to honor those headers, and if the server is not one I own I wouldn’t bet on it. 2 is interesting as I didn’t know about that, so thank you for the information. As far as 4 goes, I haven’t heard of that before so I will take a look. Thanks for the help!
I saw your post last week but have only just got round to replying. For 4, there is a project I’ve been intimately involved with for a while that is specifically aimed at addressing conflicts in linked data, using CRDTs. It’s called m-ld, and it’s currently in developer preview, seeking feedback on usability, additional use cases, etc.