Fix race condition in test 05-replicas-transfer.t

It's possible the compaction finishes before we're able
to monitor it.

Change-Id: I5b8fdeb0f9d3e0a7715a6b610622024e381a6450
Reviewed-on: http://review.couchbase.org/23606
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-on: http://review.couchbase.org/24662
MB-7764 Don't crash if reduce function calls emit()

If a reduce function called emit(), a danling pointer
was being derreferenced, which lead to a crash.

Change-Id: I3d63ae86e3a4c1027637235210fbd6dc101dc7ac
Reviewed-on: http://review.couchbase.org/24648
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-7764 Add test for reduce functions that don't return

Validate that reduce functions that don't explicitly return,
implicitely return undefined, which is serialized to a JSON
value of null.

Change-Id: Ic6ac0fe98f968ab71784927a4b2e62e19fac06af
Reviewed-on: http://review.couchbase.org/24649
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-7406: Add updater barrier for spatial indexer

Currently there's one spatial indexer for every vBucket,
hence a lot of updaters are running at the same time.
This commit adds a barrier, so that you can set the
maximum number of updaters that should run at the same
time. The default value is 4. The MapReduce indexer
already uses such a barrier.

Those two commits should me merged at the same time:
http://review.couchbase.org/24830
http://review.couchbase.org/24831

Change-Id: Ie1e2a5b2f50cfa1137ec24ed414e9d8a4adac4d2
Reviewed-on: http://review.couchbase.org/24830
Tested-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Fulu Li <fulu@couchbase.com>
Reviewed-by: Fulu Li <fulu@couchbase.com>
Merge remote-tracking branch 'origin/2.0.2'

Change-Id: Ib8fa30b94891b48684aaaa161e1de311dd32760d