MB-11325: Fix off by one error when scheduling backfills

When we register a checkpoint cursor the seqno returned is the
first seqno that will be received for that cursor. As a result we
should backfill up to one less than where the cursor is scheduled.

Change-Id: I3de5c8244f68fbb764f856877a04c2f29fb1f4be
Reviewed-on: http://review.couchbase.org/38242
Reviewed-by: abhinav dangeti <abhinav@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-11325: Fix race condition in updating persisted seqno

We cannot rely on setting the last persisted seqno by checking
where the cursor/backfill queue is after doing persistence. The
reason is that we might switch from backfill phase to checkpoint
phase in the middle of a commit which will cause the last persisted
seqno to be set to higher than what it actually is. This can cause
backfills to be scheduled pre-maturely as a result and cause us not
to read enough items off of disk.

The only place we can really trust to get the persistence seqno is
from the actual file. So when we do persistence for a particular
vbucket we should cache the last persisted seqno. This will allow us
to get this value without having to do a disk read.

Change-Id: Ie975dae49d5271f31ba7ee48fdb9e06e30eeb8ae
Reviewed-on: http://review.couchbase.org/38243
Reviewed-by: Sundararaman Sridharan <sundar@couchbase.com>
Reviewed-by: abhinav dangeti <abhinav@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>