MB-12576: Limit writer threads to 4

Having more than 4 writers increases bgfetch latencies in DGM
This change selectively reverts 32a166c511d7b242433011a875402e1278300add
Change-Id: Icdb996622237747e759c52751f2c8e613c9ba262
Reviewed-on: http://review.couchbase.org/43060
Tested-by: Sundararaman Sridharan <sundar@couchbase.com>
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
MB-12636: Release the lock before deleting a finished backfill

The DCPBackfill class contains a reference counter for a Stream
and in the desctructor for the Active stream we take a lock in
the BackfillManager. As a result we must make sure that we do not
hold the BackfillManager lock when deleting a DCPBackfill.

Change-Id: I7aca0efa6fe4208f17095c563c8e23789a7979ef
Reviewed-on: http://review.couchbase.org/43114
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Merge remote-tracking branch 'couchbase/3.0.1'

* couchbase/3.0.1:
  MB-12576: Limit writer threads to 4

Change-Id: I51de93ff690e2af260bfff54f08cbe01f2d9b30e
The atomic queue shouldn't use a different atomic class

Even if we're have c++11 atomics the atomic queue would use the
old atomic code. This change makes sure that we use a single
implementation.

Change-Id: Ibf315ece1f34c719e6ff6309d3e9fc68668c1d89
Reviewed-on: http://review.couchbase.org/43073
Reviewed-by: abhinav dangeti <abhinav@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-12540: Refactor the way we track snapshot start/end seqnos

For the 3.0 release I needed to add snapshot sequence number
quickly and in doing so implemented an approach that was not
very good and prone to errors. The correct approach is to track
sequence numbers on disk and also to track them for each checkpoint
in the checkpoint manager. This change moves us to the better
approach.

Change-Id: Ifbdd6c87b06767ff8c6504c1058ce11195fa2428