CMake: Adjust for visibility settings

Change-Id: I0726fbaad73e809fdb0a07a6535d9f8397f66002
Reviewed-on: http://review.couchbase.org/41657
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Add mc_REQDATAPROCS for extended routines needed for 'complex' commands

This will help future extensibility and uniformity when custom handling
is required.

Change-Id: Idc391287373d8998300cc72c1e4da7d1d08ad7f2
Reviewed-on: http://review.couchbase.org/41610
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Allow observe and durability operations to fail in lcb_sched_fail()

Previously these commands would end up getting scheduled anyway

Change-Id: I11d6c8d457657622fbd4c8074494260567e73a37
Reviewed-on: http://review.couchbase.org/41612
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Stylistic enhancements for durability

This is one of the oldest parts in the codebase. This commit tries to
bring the header comments and source code formatting/styling up to sync
with the rest of the code.

Change-Id: I1e7a5849b0b402c656daa467552895dc5d5f1b47
Reviewed-on: http://review.couchbase.org/41613
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
cntl: parse fractional timeout as double rather than float

This might fix some spurious test failures where the expected result is
slightly truncated on some platforms

Change-Id: Ifc4bd1d8eeef770ec1b7d54905268d06563b7607
Reviewed-on: http://review.couchbase.org/41614
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
cmake: install "libuv_compat.h" header

This breaks compilation otherwise for couchnode with a dynamic
libcouchbase

Change-Id: Ibdbd78e864bef4ef024e9745477b074a68113a73
Reviewed-on: http://review.couchbase.org/41655
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Allow to control implicit flush behavior

Change-Id: I42b0c301f0a94e187c0daa2520046dced37b030c
Reviewed-on: http://review.couchbase.org/41611
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Don't build _d suffix for tools on non-windows platforms

Change-Id: Idac3bd355ad0edddc1683cd64001733f7ce90bfd
Reviewed-on: http://review.couchbase.org/41656
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
CMake: Use OBJECT targets and build static library

This makes management of individual library components easier by
removing the intermediate "STATIC" targets for the sub components and
converting them into pseudo-targets via a so-called cmake "OBJECT"
library (see http://www.cmake.org/Wiki/CMake/Tutorials/Object_Library).
This allows quicker build times and less platform specific nuances of
using static libraries.

Additionally, this fix also now makes a dedicated couchbaseS static
library for use by tests, avoiding the need of exporting dozens of
symbols just so they can be used by the tests (in this case, they are
just linked statically with the static library).

Change-Id: If73208c8ad499f8f41d63b32b995a3359f16db01
Reviewed-on: http://review.couchbase.org/41615
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Add copyright headers

Change-Id: I43288020e8909529d485b2d856d2ffe4e43310b8
Reviewed-on: http://review.couchbase.org/41822
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>
pillowfight: allow sequential access pattern

This patch allows the pillowfight utility to be used as a simple loader
which generates and loads documents in sequence. As part of these
changes:

* Individual worker threads operate on individual items using a 'divide
  and conquer' strategy.

* The 'populate' phase is no longer a separate piece of code. It
  operates "as if" the workload was running with the equivalent of the
  workload performing only sets.

Change-Id: I8b0c51a792f4b5f062242fdc58ed8d085c974fa8
Reviewed-on: http://review.couchbase.org/41948
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
cbc: don't hang on bucket-flush

The http handler (in cbc) by default reads from stdin (in the case of
design doc manipulation).

Change-Id: I013a67ffe74c73dc7976e8db0000c72fa8fa62f4
Reviewed-on: http://review.couchbase.org/41947
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Don't set Content-Type unless specified

Otherwise this might segfault

Change-Id: I82d391f15ab2fa006a6b1311d8ed8379742d8d79
Reviewed-on: http://review.couchbase.org/41946
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
rdb: fix invalid memory access

If we're actually reallocating the segement, the return value might be
different from the old segment. Don't dereference the old segment before
freeing it

Change-Id: Idee2df3fc3f609fda10bfc655e5126853b57a88f
Reviewed-on: http://review.couchbase.org/41841
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Atomically print log messages

This is implemented only for POSIX API

Change-Id: I7668d62cf103dc821e7ca5b69069ef8ba58f527d
Reviewed-on: http://review.couchbase.org/35200
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
MB-12268: Restore 'incorrect_master' functionality

This restores the old "hacky" way of handling not-my-vbuckets by
figuring out which other node the item should be mapped to, rather than
simply relying on the new (or current) vbucket config.

Change-Id: Ie58c38f80e2ffb37994d56dda8f973ec323035c0
Reviewed-on: http://review.couchbase.org/41840
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
CCBC-519: rdb: wipe available blocks when done

This helps avoid a rather annoying memory 'leak' (when in fact we're not
really leaking, just allocating and keeping around way more than we
should be).

Note that I've still observed some smaller spikes in memory usage with
that same kind of workload, thus we might have more laying around.

Change-Id: Ice1234a354b9a395788a00a67441016eed68ed9c
Reviewed-on: http://review.couchbase.org/41842
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Confmon: log revision ID

Change-Id: Ibced5b4ccae007b37960436b63fad33ada197e2d
Reviewed-on: http://review.couchbase.org/41978
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
pillowfight: Unify thread contexts and instances

This makes the specific instance bound to its ThreadContext object,
allowing less locking contention and a more direct association between
the instance and the thread.

Change-Id: I9c0d3009eb0302e5351dea1a66be1f6910a5234e
Reviewed-on: http://review.couchbase.org/41969
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
pillowfight: run workload in infinite loop by default

Change-Id: I5b5da0f8842632239551de600f351f6849c673be
Reviewed-on: http://review.couchbase.org/41970
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>