vernemq / plumtree

Epidemic Broadcast Trees
Apache License 2.0
6 stars 8 forks source link

put is only eventually consistent? #13

Open benoitc opened 7 years ago

benoitc commented 7 years ago

when i read the source code of plumetrre_manager it looks that during 2 simultaneous put one can win over the second. i know that this rarely happen but is this the expected behaviour?

dergraf commented 7 years ago

AFAIK simultaneous PUTs will result in siblings, which you resolve during GET. The default way for resolving is using last-writer-wins (LWW).

Are you using this fork of Plumtree?

benoitc commented 7 years ago

not sure you're right. since you read then save in the db there is still a chance to put the metadata from 2 simultaneous put on different data:

https://github.com/erlio/plumtree/blob/master/src/plumtree_metadata_manager.erl#L461

benoitc commented 7 years ago

ie the metadata can miss some causality info.

benoitc commented 7 years ago

also to answer to your question i was thinking to use it with rocksdb. i

i'm rereading the code but still not sure how the metadata can't be overwritten by the last doing a put. (simultaneous reads of the metadata but a different put)

ioolkos commented 7 years ago

Well, OK, let's test it then. I guess this is approachable by Concuerror with a test spawning 2 processes that concurrently PUT?

benoitc commented 7 years ago

@ioolkos never tried it using concuerror. maybe quickcheck also