cloudant/fabric — pull request #70 by davisp (2012-11-27 20:40:13+00:00)
Title: Refactor read repair to rely on winning revisions

The old read repair forced an `open_revs=all` call which can lead to
massive resource usage for clients that introduce large numbers of
conflicts. While the logic of opening all revisions to choose a winner
is straight forward it misses the important properties of our winning
revision algorithm.

If we open multiple versions of a doc we can decide the winner directly
without opening the discarded versions because we're using a stable sort
operation for choosing revisions. Given this all we need to worry about
for read repair is that if we return a revision that it exists on a
majority of nodes in case the client tries write immediately after a
read. To accomplish if we find disparate versions we just rewrite them
after the read. We also keep the logic around to write asynchronously if
the quorum reply is a descendant of all other versions.