News for hackers. Stuff that matters.
Re:Is Redlock Safe? Reply to Redlock Analysis by reza_n on Tuesday February 09, 2016 @01:06PM (#11067295)
I understand how a fencing token can prevent out of order writes when 2 clients get the same lock. But what happens when those writes happen to arrive in order and you are doing a value modification? Don't you still need to rely on some kind of value versioning or optimistic locking? Wouldn't this make the use of a distributed lock unnecessary?
Re:Is Redlock Safe? Reply to Redlock Analysis by querulous on Tuesday February 09, 2016 @11:24PM (#11070758)
if your tokens come from a linearizable source (like zookeeper) you can do a compare-and-set to mutate state safely. you read the state, perform your mutations on it, then in an atomic transaction read the state again and if it is the same as the initial state save your new state. if your fencing token is the highest yet seen the service uses your state as the authorative state. if it's not it rejects the change
Re:Is Redlock Safe? Reply to Redlock Analysis by Terr_ on Tuesday February 09, 2016 @10:00PM (#11070486)
> But what happens when those writes happen to arrive in order and you are doing a value modification?

I believe the "first" write fails, because the token being passed in is no longer "the lastest", which indicates their lock was already released or expired.