-
Notifications
You must be signed in to change notification settings - Fork 188
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
Test deletion of object version (i.e. vclock) corresponding to CRDT version (i.e. context) #335
base: develop
Are you sure you want to change the base?
Conversation
Add tests for deletion of Riak KV object corresponding to a CRDT context i.e. at a specific vclock. Background ==== The `riakc_pb_socket:fetch_type/{3,4}` function appears not to return the vclock of the Riak KV object hence the user cannot (naively) delete the object at the vclock corresponding to a specific CRDT context being therefore induced to delete the object using the unsafe `riakc_pb_socket:delete/3` rather than `riakc_pb_socket:delete_vclock/4` - safer as catering for concurrent writes. In order to delete the Riak KV object corresponding to a certain CRDT context the user has the only option of retrieving the server-side representation of the object via mapreduce, compare CRDT contexts (between the one to-be-deleted and the one retrieved server-side) and - if equal - call `riakc_pb_socket:delete_vclock/4` passing the retrieved server-side vclock. This PR adds tests for the above for the set datatype; it also adds function to retrieve context from set. Next Steps ==== TODO Make extraction of context from Riak KV client-side CRDT representation part of behaviour `riakc_datatype` - not only of `riakc_set`. The tests show that there is room for improvement in the user API. I would prefer either: - The `riakc_pb_socket:fetch_type` function to include an option to return the vclock of the object; or - A new function `riakc_pb_socket:delete_type` to be added. I understand both options require changes in the Protocol Buffers messages definition. I partially understand the complexity in mapping from CRDT context to Riak KV object vclock because in a corner case the Riak object could contain not simply a CRDT e.g. set but unexpected siblings e.g. a set CRDT, a map CRDT, a register CRDT, a non-CRDT (I read of this corner case in the Riak KV server code). But I guess such corner case could be handled returning an error probably as if it happen the user has probably got more serious issues...
Updated this PR following merge of basho/riak-client-tools#21 - tests running now. |
This is related to basho/riak_kv#1360 As I'm sure you've found, there is no way to resolve a sibling tombstone if a CRDT is updated concurrently with a delete operation. Are you running into this issue frequently in your environment? |
@lukebakken Thanks for your note - I was writing more context notes right now and you saved me some typing. I do not experience this issue in any environment. |
OK, thanks. I just added some information to basho/riak_kv#1360. Since a resolution to this issue depends on work in Riak I am going to leave this PR open. |
@lukebakken Thanks I will follow that ticket then. Feel free to close this PR / change title. I had proposed this (and #317) PR more as a starting point for conversation, and I now understand that that ticket is the correct place to follow. I became aware of this "not easy point" in the CRDT API while prototyping / designing in a project back in Sep. I now moved on to other items in the same project and may come back to this in Feb 2017 / Mar 2017 (not sure whether and when). |
@lukebakken I thought more about this and I understand that basho/riak_kv#1360 is targeting a different issue than the one exposed by this PR.
This PR starts from the assumption that
The tests in this PR aim at preventing deleting unseen updates on a data type e.g. set. E.g. for a key:
|
Yes, basho/riak_kv#1360 has an eventual goal of dealing with the situation you describe. @russelldb - do you have any comments? |
Replaces #317.
Depends on basho/riak-client-tools#21 (merged).
Please refer to commit message for background and next steps.