MB-5492 Redirect native compactor output to log

Native compactor's stdout and stderr are redirected to the couchdb log
so that we can capture couchstore errors

Change-Id: I89feee76c0bb92d2eeb41b7174e6fe23f27c179f
Reviewed-on: http://review.couchbase.org/18163
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Aaron Miller <apage43@ninjawhale.com>
turn on changes for use in testing / debugging

Change-Id: Iaca8388dff0044531737b03f06a7dbe054920e81
Reviewed-on: http://review.couchbase.org/17751
Reviewed-by: Chris Anderson <jchris@couchbase.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Chris Anderson <jchris@couchbase.com>
CBD-438 More efficient btree copy

While folding the items (leaf values), avoid dict lookups and stores
for each item, reducing garbage creation and decreasing process
reductions. For upper levels, use an array instead of a dict, which
is more efficient than dicts (gets and sets are about twice as fast).

For a btree with 5M items, the total copy time was reduced from about
5 minutes to 3 minutes.

Change-Id: I73fd40709f2a10620548dc993be19df1bc955e8f
Reviewed-on: http://review.couchbase.org/18143
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-5820: Use new view merger only for MapReduce Views

Spatial Views don't work with the new C-based view parser
yet, hence use the old one.

Change-Id: I4e63b2e030862d05c38088f52d1f1677e81a0ff1
Reviewed-on: http://review.couchbase.org/17984
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Volker Mische <volker.mische@gmail.com>
CBD-416 Remove unneeded doc id comparison in view compaction

Not needed anymore, inherited from legacy CouchDB.

Change-Id: I7f685300287daa87f071746053975572e6757a75
Reviewed-on: http://review.couchbase.org/18294
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-5891 Add missing doc id json encode

Change-Id: Iec106b5ccd8754ad97f02675c3b4f71fc6e36173
Reviewed-on: http://review.couchbase.org/18317
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
CBD-425: Use ale logger for MapReduce errors

If we run the full stack, the errors during the MapReduce phase
will be logged into a separate log. The ale logger (which is
used by ns_server) will be used, to make it possible to display
the errors on the UI.

If the ale logger isn't available, the errors will end up in
the normal couchdb log file. This is e.g. the case when the
couchdb tests are run.

The mapreduce ale logger is called directly without using the
syntax transformation. This is done so CouchDB doesn't have
a build time dependency on ale.

This commit needs to have the mapreduce logger enabled in
ns_server (http://review.couchbase.org/18292) in order to see
the errors logged with ale to a separate file.

Change-Id: I4ff7724f83da018631e4324da56ed226235fda2e
Reviewed-on: http://review.couchbase.org/18293
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Volker Mische <volker.mische@gmail.com>
WIP separate document body and meta arguments to map function

Sends non-JSON values as byte arrays for the 'doc' argument.
Numbers and ascii text can be decoded trivially from this
capability, extending our support for legacy applications.

The document JSON format on the wire for the Admin server
client looks like this now:

    {
      "body":{"user":"data","_anything":"goes"},
      "meta":{"id":"mydocid"}
    }

Turns off support for _id lookups in include_docs queries,
although with server level include docs going away as well,
this change should be of little consequence.

TODO: EP engine doesn't need to check for _fields when setting
JSON flag.

TODO: combine this with the specifications document, on a jira ticket,
and link to the ticket.

TODO: fix any tests using REST api for new document format

Admin UI and ns_server changes are in this change:
http://review.couchbase.org/#change,18028

Depends on this change in testrunner for view tests:
http://review.couchbase.org/#change,17768

Change-Id: Ic8e3c5be07bd59b08f618b6f735e46c96ee4c9f2
WIP restructure internal JSON doc usage for new JSON format

Change-Id: I0a780a084f007c6dfca86d7a0ef8704de1b5494f
WIP alter couch_set_view tests to use the new doc format

This moves the tests over to the new JSON format.

Change-Id: Ife4315db7cb2b1ffb22da0b7bfabd4f60b43c4cf