CBDE-881:  merge couchdb changes to 2.1.0 branch for 2.1.1 patch

Change-Id: I146a018ef3df0fae9f47505769ead73edb2bec7b
Reviewed-on: http://review.couchbase.org/30176
Reviewed-by: Philip Labee <philip@couchbase.com>
Tested-by: Philip Labee <philip@couchbase.com>