Database Reference
In-Depth Information
Consistency
Masterless replication confers huge advantages in maintaining full availability in the face
of hardware failure, but it also creates a thorny, if subtle, problem: how can we be sure that
the data we're reading is the most recent version of that data?
Let's first consider the master-follower architecture we discussed above. When our applica-
tion issues a write request to the master instance, that request only returns a successful re-
sponse once the data has been successfully written to the master instance. A successful re-
sponse does not, however, guarantee that the data has been replicated to all of the follow-
ers: any master-follower system will involve some delay before write are replicated to the
followers.
Still, in this system, there is a simple way to guarantee that, when we read a piece of data,
we're reading the most up-to-date version of it: simply read from the master. Of course, if
we only ever read from the master, the followers don't do much for us other than providing
a hot standby in case the master fails. But if we identify specific situations in which it's
critical to have a guarantee that we're reading the most up-to-date data, we can read data
from the master in only those situations, and make use of the followers in other scenarios.