Search code examples
databasedatabase-designlogiccomputer-sciencecap-theorem

CAP Theorem - satify consistency by always erroring on read


The wiki page and one of my instructors say

Consistency: Every read receives the most recent write or an error.

I have learned we can only satisfy two of them at all-time, but, seriously, wouldn't the "or an error" part mean we could satisfy the other two first, and then design the software to throw errors for all read operations? Then we have satisfied all three of them for all-time.


Solution

  • See the definition for "A". In order to satisfy "A", the response should not be an error. If you throw an error every time, how can the system satisfy "A" which stands for Availability? You only satisfy "C" and "P".

    From Wikipedia.

    Availability Every request receives a (non-error) response, without the guarantee that it contains the most recent write.