CCBC-414: Assign cccp cookie when sending over server struct

We never assigned to cccp->cmdcookie

Change-Id: Ibfaaf2f6c590d1af684c83d29bc461122ffe741d
Reviewed-on: http://review.couchbase.org/37321
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
CCBC-420: vbucket: don't remap to soon-to-be-removed nodes

See the bug and the linked MB issue for more details. In summary, during
a rebalance-out where nodes are being removed, the node's memcached
process will remain active accepting connections and commands but
responding to them with not-my-vbucket replies. The goal for this grace
period is to allow for a graceful remapping of items to the new master
node.

This behavior itself relies on the fact that the given node shall only
respond for _existing_ commands mapped to it before (or around) the
start of the grace period, but that no _new_ commands should be sent to
it during said period.

The means to determine if a node is in such a "Eject Wait" state (as
I'll call it here) is to check whether it has any vbuckets assigned to
it. If the node has no vbuckets assigned to its index then we should
assume that it will soon disappear. Implemented here, the number of
vbuckets a node is assigned to is the sum total of any vbucket in both
the vBucketMap and the vBucketMapForward arrays which contains the index
of the given node in its list.

The found_incorrect_master() function's purpose is to pick a node at
random (or slightly more predictable than 'random') where a command
should be forwarded to assuming that the current mapped node returns a
not-my-vbucket. In this commit I've tried to ensure that the new node
should only be one which retains vbuckets.

Change-Id: Ib8017ea07a38c2479deebcb532af131ec2150942
Reviewed-on: http://review.couchbase.org/37322
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
CCBC-433 A new randomization algorithm.

Now using a Fisher–Yates shuffle to randomize the host list.

Change-Id: I03ccffdaedfcfe52f5fbddb367657fc8e0c76074
Reviewed-on: http://review.couchbase.org/37706
Reviewed-by: Dave Rigby <daver@couchbase.com>
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
CCBC-435: retrieve command _after_ "purge_implicit_responses"

Change-Id: I126f7ef350cb983567ef923d33c83c43b8ca24d8
Reviewed-on: http://review.couchbase.org/37712
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
CCBC-449: Include pillowfight in list of cbc commands.

Change-Id: I726227219b6cc6f57da8f25c4cfb2a4abf4c7fbf
Reviewed-on: http://review.couchbase.org/38223
Tested-by: Dave Rigby <daver@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Merge packet-ng

Conflicts:
	contrib/libvbucket/cJSON.c
	contrib/libvbucket/vbucket.c
	include/libcouchbase/compat.h
	include/libcouchbase/types.h
	include/libvbucket/vbucket.h
	man/bsd/man3/lcb_cntl.3
	man/bsd/man3/lcb_create.3
	man/bsd/man3/lcb_strerror.3
	man/bsd/man3/libcouchbase.3
	man/man3couchbase/lcb_cntl.3couchbase.txt
	man/man3couchbase/lcb_create.3couchbase.txt
	man/man3couchbase/lcb_strerror.3couchbase.txt
	man/man3lib/libcouchbase.3lib.txt
	man/svr4/man3couchbase/lcb_cntl.3couchbase
	man/svr4/man3couchbase/lcb_create.3couchbase
	man/svr4/man3couchbase/lcb_strerror.3couchbase
	man/svr4/man3lib/libcouchbase.3lib
	src/arithmetic.c
	src/bconf_provider.c
	src/compat.c
	src/connect.c
	src/connection_utils.c
	src/flush.c
	src/get.c
	src/http_parse.c
	src/packet.c
	src/remove.c
	src/server.c
	src/server_io.c
	src/server_parse.c
	src/stats.c
	src/store.c
	src/touch.c
	src/verbosity.c

Change-Id: I24862d2c0bb7e6df701089b0ca9810c9a29f635b
Reviewed-on: http://review.couchbase.org/38540
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
CCBC-453: Add pause-at-end option to pillowfight

Adds a new --pause-at-end (-E) option to pillowfight. When specified,
pillowfight will pause after completing its workload (keeping
connections open) until it recieves user input.

Change-Id: I6cdff66a29150de0c24352f7eb11af62f2f2db7f
Reviewed-on: http://review.couchbase.org/38473
Tested-by: Dave Rigby <daver@couchbase.com>
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>
pillowfight: rename num-instance to num-instances

typo

Change-Id: Id653cc407bb9607d156c11d50a249bd6bf32662d
Reviewed-on: http://review.couchbase.org/38591
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
Pillowfight: Properly handle timings

- Don't spam the screen with timings for each iteration. Print them rate
  limited for each second.
- Fix header printing

Change-Id: I80465a4c067e4991e9e2d3936aade2c6cc1f4e8b
Reviewed-on: http://review.couchbase.org/38592
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
histogram: use 4 digit slots

Change-Id: Ifc96a9fa6a1b346a5405e9df3ec02c502d17dad3
Reviewed-on: http://review.couchbase.org/38593
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
CCBC-273: Increase granularity for timings between 1-10ms

Change-Id: Ie39e329a37172aef7b55b8b7384daeb08c60ab80
Reviewed-on: http://review.couchbase.org/38594
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Update README for latest changes

- Declare dependencies
- Provide note about OS X OpenSSL
- Add mention of release23 branch
- Remove mention of packet-ng branch
- Remove reference to 1.x blog - we're moving away from that model
Change-Id: I8399895bf740df114b082dba33c2d0c8c96ba9f8
Reviewed-on: http://review.couchbase.org/38595
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Restore changelogs to 2.3.1 versions

Change-Id: I4a78371daf1f4e65b954c7682a4c4d63a4352552
Reviewed-on: http://review.couchbase.org/38626
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Update release notes for 2.4.0-dp1

Change-Id: I01fa8889564212c9d52049206a4de1bf18399531
Reviewed-on: http://review.couchbase.org/38570
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Update packaging scripts

This consists of a set of changes allowing proper packaging for the
newer library version. These changes are:

- Use common scripts to deduce version information
- Remove man3 and cbcrc manpages from installation list
- Build with a static snappy on RPM platforms
- Debian platforms require a system-provided libsnappy
- Enhance debian script for paralell building

Change-Id: If9f6e973cd85d9bec6a3208e997bad93a04de62d
Reviewed-on: http://review.couchbase.org/38569
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Update release metadata for 2.4.0-dp1

This bumps up the 'revision' ABI number to 16. The previous was 14, but
a prospective 2.3.2 will be 15

Change-Id: I463a769849aae62868e11f69dbe2d00e0dd80a4b
Reviewed-on: http://review.couchbase.org/38571
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Update to latest CouchbaseMock

Change-Id: I4275f924e02e10fd28fd8d403b6a70f19ebc2d38
Reviewed-on: http://review.couchbase.org/38625
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Fix win32 build (declaration and code mix)

Change-Id: Id1b9c93df95e28f905732367ef049c5589f2597c
cmake: Fix download handling

Sometimes cmake's download handling gets stuck on various platforms.
This abstracts downloading into its own module and employs either wget
or powershell to perform the actual download.

Change-Id: I1dd01b2b8559455549d03d088d13e8b509d89550