user10067596
user10067596

Reputation:

Is it possible to get strong consistency in a distributed system?

User sends a write request.
Someone then sends a read request for that resource. The read request arrives before the write request, so the read request data is stale but has no way of knowing that it's stale yet. Likewise, you could also have two write requests to the same resource but the later write request arrives first.

How is it possible to provide strong consistency in a distributed system when race conditions like this can happen?

Upvotes: 0

Views: 397

Answers (1)

mevets
mevets

Reputation: 10435

What is consistency? You say two writes arrive "out of order", but what established that order? The thing that establishes that order is your basis for consistency.

An simple basis is a generation number; so any object O is augmented by a version N. When you retrieve an O, you also retrieve N. When you write, you write to O.N. If the object is at O.N+1 when the write to O.N arrives, it is stale and generates an error. Multiple versions of the O remain available for some period.

Of course, you can't replicate the object readily with this in any widely distributed system, since two disconnected owners of O could be permitting different operations that would be impossible to unify. Etcd, for example, solves this in a limited since. Block chain solves it in a wider sense.

Upvotes: 1

Related Questions