Optimistic Consistency
Optimistic schemes takes the other extreme towards limiting availability
for guaranteeing consistency : they don't limit availability at all.
Any copy can be read or updated at anytime.
This is important for several applications that wish to have almost
continuous and guaranteed access to data.
Conflicts
These read-any, write-any schemes that allow updates to any available copy
can introduce inconsistencies during partitions.
Inconsistencies that arise due to conflicting updates are resolved
when the network partitions heal.
The time lag between the update and resolution of the inconsistent update
depends on the length of the network partition.
Problem
While one partition updates the data, another could be reading or worse still
updating the data.
Thus users could read stale or conflicting data.
This breaks the single copy consistency model where users always read and
write the latest data and
increases the complexity of the system for the user.
Solutions After the Fact
Since inconsistencies can occur during partitions,
optimistic systems provide a conflict detection and resolution scheme.
When updates are conflicting, the detection scheme detects the writes that
were conflicting.
The resolution scheme can be of two types:
- Undo-redo
- The updates that were conflicting are undone by
running compensating actions and then a set of corrective updates are
applied.
- Corrective
- No updates are undone. Only corrective
updates are applied.