MB-10273: Reduce the number of btree flushes

With commit d707d352a2cd03cfb9c8dd726f007ad32566d415 [1] the updater
was flushing to disk (i.e. updating the btrees) whenever there was
a snapshot boundary. This lead to a lot of i/o. This commit is
reverting this change and replaces it with some in memory operations.

Before changes are flushed to disk, a certain number of items (based
on the total size) is buffered in memory. This buffer must contain unique
items only, before flushing.

We now allow temporarily to have duplicated items in that buffer and
de-duplicate them right before they get inserted into the btree. This
saves i/o. A quick an dirty test showed that the flushes are reduced
by around 50%.

[1]: http://github.com/couchbase/couchdb/commit/d707d352a2cd03cfb9c8dd726f007ad32566d415

Change-Id: Ib8cf8463347cbccf3b249f47f68aa88c450993a9
Reviewed-on: http://review.couchbase.org/38308
Reviewed-by: Sarath Lakshman <sarath@couchbase.com>
Tested-by: buildbot <build@couchbase.com>