After a rescan prevent checkpoints from a previous epoch

Fix race condition which happens on rescan: rescan
function resets all checkpoints for replicator databases.
However before new change feeds start processing all
documents from sequence 0, a checkpoint could
happen from an existing change feed, which would
effectively result in a range of documents being
skipped over.

Add an `epoch` ref to State. On rescan update
the epoch. Thread epoch through the change feed process
and callbacks, then only allow checkpoints from current
epoch.

JIRA: COUCHDB-2965
1 file changed
tree: f4cf1b9af5bb053fb99fd77ed8ff524c8f2e1259
  1. priv/
  2. src/
  3. test/
  4. .gitignore
  5. .travis.yml
  6. LICENSE