MB-5307: correctly account for very heavy memcached requests

As pointed out http://review.couchbase.org/16839. We were looking at
count of heavy requests instead of very heavy requests when making
decision to start very heavy requests. Thanks Aliaksey.

Change-Id: I6a184513c1d9f0f8770cf721c5477163e66d93b6
Reviewed-on: http://review.couchbase.org/16873
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5307: configure-ized max count of concurrently moved vbuckets

This is now controlled by ns_config key rebalance_moves_per_node.

Change-Id: I9d26c8beae63725eb0d093ccf8ffff2e64cd2671
Reviewed-on: http://review.couchbase.org/16935
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5307: try to wait for all built replicas has same checkpoint

Change-Id: I08ef2c0a7144af7d21b96d94744d27d2feaaf537
Reviewed-on: http://review.couchbase.org/16936
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5307: parallelize sync_shutdown_many for less latency

Change-Id: I6a6debc59b23f60d85d3731849338cd25268608d
Reviewed-on: http://review.couchbase.org/16937
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5307 Pass global port to memcached via -p.

Change-Id: Iafd3c2371863b42581ea1dcd82545cc5dcb862f6
Reviewed-on: http://review.couchbase.org/17048
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307: [bp] Fix cluster overview graphs showing blank data

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

Change-Id: Ic330da56cd50cbcca13df0f2dd73c139969f8aec
Reviewed-on: http://review.couchbase.org/17049
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307: increased size of master activity events history

With recent changes we're now routinely cannot hold even single bucket
rebalance in our 'archive'. Hopefully making it larger helps.

Also it's now somewhat runtime-configurable.

Change-Id: Id66d204ebe217b8769404678a5f90e7041f39a95
Reviewed-on: http://review.couchbase.org/17079
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5307: only consider stopping rebalance for normal janitor runs

We also run janitor as part of failover. And that janitor cleanup run
is made on orchestrator process itself. So trying to ask orchestrator
if rebalance is running times out as we're asking ourselves.

The fix is only consider stopping rebalance when it's normal
scheduled janitor run.

Change-Id: I8967a12343cedc51bbf1e2013f7c4ed97a573e3e
Reviewed-on: http://review.couchbase.org/17080
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5307: fixed getting of not ready to replicate from vbuckets

Implementation of get_open_checkpoint_ids/2 was returning dict with
stat names as keys instead of vbucket numbers. That was causing us to
never detect any vbuckets as not ready to replicate from.

I decided to optimize things a bit further by asking specifically for
vbuckets with open checkpoint 0 and by trying to minimize produced
garbage that was typical for previous implementation that was building
dict.

Change-Id: Ice165d2161348bc9f92a99d8340a8ab0bc9f1f5e
Reviewed-on: http://review.couchbase.org/17081
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5307: fixed dialyzer complaints

I couldn't understand what it was trying to tell me and if it was
genuine problem. Anyway new way is a bit more correct as we'll raise
missing_checkpoint_stat exception even if first checkpoint is 0.

Change-Id: I2c9ab5a1511f21d6eff81f0e4da8604c8d198984
Reviewed-on: http://review.couchbase.org/17082
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5308 Bound unallocated memory by zero.

It could be less than zero if some of the nodes were down.

Change-Id: I8acff37db9be223639bd2ea8a43f367465220970
Reviewed-on: http://review.couchbase.org/17087
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5500 Show all the gauges as N/A if anything goes wrong.

Change-Id: If3682f4e0841a9c5fe1b68a6cec7926c0331a7a7
Reviewed-on: http://review.couchbase.org/17086
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5484: updated disk creates/updates per sec descriptions

As pointed out in ticket.

Change-Id: I46f482920a42443945698df98a484b92d74b53df
Reviewed-on: http://review.couchbase.org/17103
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5513: wait isasl.pw refresh before flagging warmup completion

With this change bucket will only be marked as warmed up after bucket
config is reflected in isasl.pw. So that ebucketmigrators and other
clients can actually auth against bucket after janitor completed
bringing it up.

Change-Id: I9d58ab1d66e1b480c934896b5bba1755bcc6171d
Reviewed-on: http://review.couchbase.org/17104
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
CBD-364: got rid of "plant tree" option for enterprise edition

I was told we can't do that anymore.

Change-Id: If13f721ed32c8a092ec47d2e01f7662db6d6d5d1
Reviewed-on: http://review.couchbase.org/17108
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
CBD-172: gather and display average disk update time

Instead of write_seeks_distance which ended up being less useful than
initially thought.

Change-Id: Ic3c3bdbd1ef99c6b4e31bb51c98780de0d04b313
Reviewed-on: http://review.couchbase.org/17109
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
CBD-172: hide bg_wait_time and disk_commit_time in UI

But allow access via editing URL

Change-Id: Id82619b00cd425f695c88a6fa7fde83edeb6ac5b
Reviewed-on: http://review.couchbase.org/17110
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Merge remote-tracking branch 'origin/branch-181' into branch-18

* origin/branch-181:
  CBD-172: hide bg_wait_time and disk_commit_time in UI
  CBD-172: gather and display average disk update time
  CBD-364: got rid of "plant tree" option for enterprise edition
  MB-5513: wait isasl.pw refresh before flagging warmup completion
  MB-5484: updated disk creates/updates per sec descriptions
  MB-5500 Show all the gauges as N/A if anything goes wrong.
  MB-5308 Bound unallocated memory by zero.
  MB-5307: fixed dialyzer complaints
  MB-5307: fixed getting of not ready to replicate from vbuckets
  MB-5307: only consider stopping rebalance for normal janitor runs
  MB-5307: increased size of master activity events history
  MB-5307: [bp] Fix cluster overview graphs showing blank data
  MB-5307 Pass global port to memcached via -p.
  MB-5307: parallelize sync_shutdown_many for less latency
  MB-5307: try to wait for all built replicas has same checkpoint
  MB-5307: configure-ized max count of concurrently moved vbuckets
  MB-5307: correctly account for very heavy memcached requests

Conflicts:
	src/mc_client_binary.erl
	src/ns_janitor.erl

Change-Id: I7c8badb8a238c83ed144112e8686d23561ab254a