-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add shared state multiwriter #872
Add shared state multiwriter #872
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work Ger!
i've started reviewing it, though haven't finished... so gave a few comments and will come back later.
How is the case node clock is out of sync (both in far past and in far future) handled? |
Right, nodes with dates in the future are very problematic. If that case was seen in the field I propose to change the method using other merge strategy like the specified here #868 , what do you think about the other strategy? (quoting) . Another scheme is to use a counter and a random string nounce. For example the key starts at with counter: 1, nonce: "s6qgHkMT", and then other node changes it to counter: 2, nonce: "mEVfaCb7". If the counters are equal the lexicographic order is used is used to select the winner for the merge. |
Replace the timestamp merge strategy that has many issues on the field with a counter + a random number merge strategy.
6365432
to
dcb099e
Compare
Codecov Report
@@ Coverage Diff @@
## master #872 +/- ##
==========================================
+ Coverage 72.45% 72.64% +0.19%
==========================================
Files 41 41
Lines 3616 3678 +62
==========================================
+ Hits 2620 2672 +52
- Misses 996 1006 +10
Continue to review full report at Codecov.
|
I've pushed a new merge strategy using a counter and a random number and one fix for a bug that german spoted. |
Oh, the comments I made at #873 should have been here! |
…p-compare utils: early comparison of same table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are now ready to merge :)
As per the discused roadmap with gio (#884) this is ready for merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I skimmed through it ... it looks fine, no big issues.
thanks for the contributions!
This PR implements the Multi Writer proposal from #868 . Thanks @germanferrero for the ideas and implementation, I have only fixed some bugs.
Fixes #868
Currently shared-state can't store information in a way that multiple nodes can modify all its keys (multi-writer).
This is because the author of a key is re-publishing it with the biggest TTL all the time, not leaving space for others to modify the value of that key. It was though for a one writer per key scheme. This scheme can be used to create "streams" of data applying inteligence above shared-state (for example the scheme used by pirania to use a new key for each modification of each voucher) but this is not only more complex, it has to be redone for each use case. So we believe that being able to have keys that can be modified by any node is a step forward to simplicity in some use cases (mainly when the informacion needs persistance).
This adds a multi-writer mode that can also persist the information so that it survives reboots of the full network (for example due to a big power loss in the region).
There are a lot of use cases, for example: List network nodes service #867
The following should me considered as premises when using the multiwriter:
This PR: