[bp] added ns_bucket:get_bucket/2

Originally reviewed on http://review.couchbase.org/12760

Change-Id: I0f9dd80d578c9d8f5839a6a3cc4621b829ac5bbd
Reviewed-on: http://review.couchbase.org/13958
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
[bp] got rid of unused ns_vbm_sup:kill_dst_children

Originally reviewed on http://review.couchbase.org/12345

Change-Id: Ie4869f2d3eaaf9e93ab76b55c5bf6549ffc53149
Reviewed-on: http://review.couchbase.org/13951
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
[bp] added description of misc:multicall_result_to_plist_rec/2

Originally reviewed on http://review.couchbase.org/12758

Change-Id: I191f5ba039d7938f9fab39c6b1138127e50ce2e9
Reviewed-on: http://review.couchbase.org/13950
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
[bp] optionally refresh replication graph svg

Originally reviewed on http://review.couchbase.org/12344

Change-Id: I3d26273aff5abe667c72366bf97b43bc3b50a83a
Reviewed-on: http://review.couchbase.org/13952
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
[bp] moved vbucket map visualization code out of janitor

Originally reviewed on http://review.couchbase.org/12346

Change-Id: I80817673927efff3d86a442f56ddbd85f5316e48
Reviewed-on: http://review.couchbase.org/13953
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
[bp] extracted ns_doctor:get_node/2

Originally reviewed on http://review.couchbase.org/12759

Conflicts:

	src/ns_doctor.erl

Change-Id: I9a7395ffabd1eabebf0282d6d1e70695e1534c21
Reviewed-on: http://review.couchbase.org/13957
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
[bp] fixed long polling timeouts during rebalance

2.0 rebalance performs incremental vbucket map updates this is causing
constant stream of menelaus_event notifications. Old
handle_pool_info_wait could delay long polling reply infinitely when
this happens. This was visible as "Lost connection to..." thing on UI
due to long polling request timing out.

Originally reviewed on http://review.couchbase.org/11933

Change-Id: I26b187f0c0d97acd7e11255d1e78846afad78a03
Reviewed-on: http://review.couchbase.org/13961
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
implemented set_param command and fixed bucket resizing.MB-4872

Also note that ns_memcached will now crash if resizing command didn't
succeed. Part of our problem previously was that error was really
silently dropped on the floor.

Change-Id: I5c4c37086aa74c4a724358a240c120889688b98a
Reviewed-on: http://review.couchbase.org/13842
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Srinivas Vadlamani <srinivas@couchbase.com>
unbreak warmup completion detection

This was recently broken by ep-engine stats change.

Change-Id: I07c4e59767c755a59c6c8fdbd039946f49aadd5b
don't register/unregister ns_memcached to late/soon

There's seeminly no need anymore. And it allows us to check if bucket
is still running by looking at registered processes.

Change-Id: Iecef1bed6690e20cc14d3f8caed2dbdcd27bf6ab
actually delete buckets when node is failed over

Not just shutdown ns_memcached. Right now we shutdown ns_memcached,
delete bucket without force option but leave data files. Those files
are deleted when node is finally ejected, but if user does add-back
instead it leads to lengthy warmup of those data files. Essentially
not allowing rebalance without good reason.

Change-Id: Iba2a82e35471b496e04ec2c433a3868a4f886176
try to delete data files even if delete bucket failed

So that if memcached crashes/dies when we're force deleteting bucket
we still delete data files.

Change-Id: I2ab6d7212091351f4f04cc0d2b81ef4455176237
allow port_servers to send arbitrary data to port's stdin

Change-Id: I3de786db1d573fa8abf93d7dc73f1dc4291847fb
made supervisor_cushion exit with same reason as child

So that termination with reason normal is normal.

Change-Id: I74defba6ddb9f114671cfd448d7278b2402b10ef
ask memcached to die real quick on failover

We send die! message that we expect memcached to just do _exit. We'll
then restart it, but the idea is that per bucket supervisors are
already shutting down for this node.

Change-Id: If626710ecf1abe9cbaef3b9f343e2adbe0a97039
kill only memcached only on transition

Change-Id: I88a6433f5645bec125fc06ecb185867c2b34f96b
deactivate node now marks it as failed over

Change-Id: Ifeae193e775f6324dc9fa46b603be6ec6b913636
try not creating bucket if it's running on any cluster nodes

We'll do best effort check if ns_memcached for this bucket still
exists anywhere and refuse creating it.

Best-effort here means that we'll try to reach other nodes, but with
sane timeout and if we cannot we'll assume it's fine. It is consistent
with current behavior and don't want to change that.

It is intended to prevent issues when somebody tries to re-create
bucket too soon after it was deleted. And to protect us from any
issues in ep-engine/bucket-engine that may delay bucket deletion. See
for example http://www.couchbase.com/issues/browse/MB-4329

Change-Id: I8d66cb5dc9603b4da8ad9ca430a0cd112e2a422f
handle errors_500 from do_bucket_create in setup default call

Change-Id: I0f005254ce8aef10e1c7b501e4310ef2e565d21d
fixed filter_ready_buckets support of memcached buckets

Without this fix memcached buckets that are not yet "rebalanced" will
not be actually started on new nodes and that will cause periodic
crashes of hot keys keeper.

Change-Id: I3c366efc3e75d7ab2e9f2c4f1eef3318d14f8d4e