Open requilence opened 4 years ago
@requilence , thanks for your report!
Yes, there's a big limitation in the json patcher since it doesn't have any kind of causal ordering. Apart from the scenario you describe there're other "problems" such as the state of the db not converging depending on how saves are processed by different peers. Of course, all depends on how you plan to use the data and if that's a limitation.
We have plans to introduce CRDTs Event Codecs to give strong eventual consistency. So stay tuned!
Yep, it's a problem! There's two things that need to be added to really make this work well:
@sanderpick @jsign Sounds cool! Just to make sure I got it right, the log records themselves will not be affected and the ordering mechanism will be on the level of Events Reducer, right?
Also, jsonpatcher has Timestamp encoded in the Event. It's far from the ideal solution but if we will sort events in the Reducer by Timestamp it will solve some of the surface problems like I have shown
Consider scenario:
Create
new item in the collectionSave
the item with the same_id
Save
beforeCreate
leading to Fatal error hereHere I have the example based on json-books: https://gist.github.com/requilence/a9d1c4ceab32e1f09b1ce2f3e895e242 It always fails with
FATAL app app/app.go:185 can't save nonexistent instance
But the roots of this are much interesting. Do you consider any sorting of events between different logs? Here are some ideas:
This way the client can reconstruct the partial ordering of events between logs and there will be much more space to solve conflicts in the Events Reducer