CCBC-420: vbucket: don't remap to soon-to-be-removed nodes
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 <340b8e09ca65cd3fc686427fcfed17e87eaf61e2@gmail.com>
Reviewed-by: Matt Ingenthron <1fa2ef4755a9226cb9a0a4840bd89b158ac71391@couchbase.com>
Tested-by: Mark Nunberg <e7d42768707bf23038325b0b68d4b577e5f6064a@haskalah.org>
Reviewed-by: Brett Lawson <c8c4369773d7d7226e031f0c4af62e3f38a08510@gmail.com>

avsej/libcouchbase,senthilkumaranb/libcouchbase,kojiromike/libcouchbase,couchbase/libcouchbase,PureSwift/libcouchbase,mnunberg/libcouchbase,senthilkumaranb/libcouchbase,mody/libcouchbase,maxim-ky/libcouchbase,kojiromike/libcouchbase,signmotion/libcouchbase,maxim-ky/libcouchbase,mnunberg/libcouchbase,kojiromike/libcouchbase,avsej/libcouchbase,couchbase/libcouchbase,PureSwift/libcouchbase,maxim-ky/libcouchbase,couchbase/libcouchbase,avsej/libcouchbase,mnunberg/libcouchbase,couchbase/libcouchbase,mnunberg/libcouchbase,mody/libcouchbase,signmotion/libcouchbase,avsej/libcouchbase,avsej/libcouchbase,maxim-ky/libcouchbase,signmotion/libcouchbase,avsej/libcouchbase,mnunberg/libcouchbase,avsej/libcouchbase,PureSwift/libcouchbase,couchbase/libcouchbase,couchbase/libcouchbase,PureSwift/libcouchbase,mody/libcouchbase,senthilkumaranb/libcouchbase,kojiromike/libcouchbase,signmotion/libcouchbase,mody/libcouchbase,couchbase/libcouchbase,senthilkumaranb/libcouchbase