MB-24089: Handle DCP backfill buffers smaller than item size correctly
When items are drained from DCP readyQ, we free up the DCP backfill
buffer (that is, we decrement its memory usage). This commit addresses
2 bugs in that:
1. We never set the backfill buffer full status to false when the
next read size is larger than max buffer size. This can result in
backfill hangs with items larger than backfill buffer size.
2. We may never set the backfill buffer full status to false when
buffer.bytesRead == (buffer.maxBytes * 3 / 4) == 0. In practice
this may never happen as buffer.maxBytes is generally > 4 :).
This commit has fix for both 1 and 2. Also adds a functional test
and a unit test reproducing the bug 1.
Change-Id: Icf9512bbe6f21296374958b69cfbe851ec8873b3
Reviewed-on: http://review.couchbase.org/77304
Reviewed-by: Dave Rigby <daver@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>