Remove unncessary API function export

This function is not meant to be available outside
the couchstore library.

Change-Id: If8fc5f82b133e879c15bafe97749be8ad11af8de
Reviewed-on: http://review.couchbase.org/27313
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-7629: Add support for Javascript view reduce functions

Besides those built-in reduce functions _sum, _count, _stats for view
btree and view id btree, this is to add generic reduce functions
for view btree to support Javascript view reduce functions. Unit tests
are also included.

Change-Id: I7a8988b359173b91357f6e6cfe51e87032b039bd
Reviewed-on: http://review.couchbase.org/27175
Tested-by: Fulu Li <fulu@couchbase.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Shorter names for unexported functions in reducers module

Change-Id: I721084eddd5c7852537e240f53148e0338d8a85b
Reviewed-on: http://review.couchbase.org/27362
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Fix some memory leak issue in mapreduce unit test

Change-Id: I45c38ca8e4e194ff520153b972349941cc2cc1d9
Reviewed-on: http://review.couchbase.org/27366
Tested-by: Fulu Li <fulu@couchbase.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-7629: Add support for Javascript view rereduce functions

Besides those built-in _sum, _count, _stats reduce and rereduce
functions for view btree and view id btree, we add support for
Javascript view reduce and rereduce functions. In this txn, we add
support for Javascript view rereduce function and its related unit
tests.

Change-Id: I13e87ec91b63c56ae66316d76bfe543d39968056
Reviewed-on: http://review.couchbase.org/27395
Tested-by: Fulu Li <fulu@couchbase.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Use correct and non-hardcoded buffer sizes

The magic values 44 and 10 were harder for a reader to guess and
larger than necessary. The new and correct values also end up saving
57 bytes per doc info record.

Change-Id: Ieeff565d96acc929b43245686126228d3b401161
Reviewed-on: http://review.couchbase.org/27454
Reviewed-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: Aaron Miller <apage43@ninjawhale.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Add missing database close calls in tests

Change-Id: I2f304ebbef41772340a74b0682f5b6c08de73ac3
Reviewed-on: http://review.couchbase.org/27455
Reviewed-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: Aaron Miller <apage43@ninjawhale.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Remove duplicated assignment

Change-Id: Ifcb80da4d2c53e50778cd1b64cf38b5c3aa3c60d
Reviewed-on: http://review.couchbase.org/27559
Reviewed-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: Aaron Miller <apage43@ninjawhale.com>
MB-8531: Add initial spatial index building

This is already build to work with n dimensions.

Currently only the key-value sorting is implemented
in C. The actual tree building is still in Erlang.
Change-Id: I8edd00cfb5341907369b468da6a9aca4ed13c21c
Reviewed-on: http://review.couchbase.org/27196
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-8012 Compactor can do timestamp-based purge

Passing --purge-before <timestamp> will drop any deletion records with
an expiration time less than the timestamp.

Change-Id: I2d4d903f7c83d53269b4394d0e80385d75e1c199
Reviewed-on: http://review.couchbase.org/27426
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Fulu Li <fulu@couchbase.com>
Tested-by: Aaron Miller <apage43@ninjawhale.com>
MB-100: Fix some warnings

Some additional warnings are shown when compiled with -Wextra
and When compiled clang. This commit fixes those.

Change-Id: I8f45fc4e5ab57fce19c2b21ac76939940fe7701b
Reviewed-on: http://review.couchbase.org/27655
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: buildbot <build@couchbase.com>
Include crc32.h only once

Change-Id: I4d60fe748431ad3602456b3e9854b53a1c438fe5
Reviewed-on: http://review.couchbase.org/27675
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-8708 Allow for multiple reduces in view btree reductions

A single view btree's reduction can encode multiple values
coming from different reduce functions (views).

Change-Id: Ief273ebbbb1e29b873fec48a8c6adcdf44f5beda
Reviewed-on: http://review.couchbase.org/27683
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Fulu Li <fulu@couchbase.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-8710 Optimize view reducers

Avoid decoding the same reductions and values multiple times,
reducing cpu consumptiom and memory allocations.

Change-Id: I54372df280998181d871dd18cce9339c5cbd9215
Reviewed-on: http://review.couchbase.org/27684
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Reviewed-by: Fulu Li <fulu@couchbase.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Merge branch '2.1.1'

Conflicts:
	src/db_compact.cc

Change-Id: I8cf3820220adbab5998b0df5e63d0a60356551e2
MB-8780: added compaction option to avoid purging too new seqnos

Change-Id: I0dcdba09c276ca233add69446947e8f8906905fc
Reviewed-on: http://review.couchbase.org/28034
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: Aaron Miller <apage43@ninjawhale.com>
Fix memory/resource leaks on tree_file_open() failure

Change-Id: I72fc39057458fad80471630d6f772688a95c0e3a
Reviewed-on: http://review.couchbase.org/28630
Reviewed-by: Aaron Miller <apage43@ninjawhale.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-7656 Remove not used anymore btree code

Not used anywhere.

Change-Id: Ie9451d79a2925a68b757d2177faadbc322b5e694
Reviewed-on: http://review.couchbase.org/28742
Reviewed-by: Aaron Miller <apage43@ninjawhale.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-7656 Allow max db header to be a parameter

Because the current hard coded value is only appropriate for
databases, and a couch_file_reader module should be generic
enough, not knowing anything specific about databases.

Change-Id: Ieec17af30817438dc402373509ac7bf3cac6b6f7
Reviewed-on: http://review.couchbase.org/28789
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-7656 Make file arg for read APIs const

It doesn't need to be non-const. This makes the API more clear.

Change-Id: I6944e294abf625f5da42c50f09d8827ac1cc2159
Reviewed-on: http://review.couchbase.org/28791
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>