un-leak memory in cluster settings form validation code

Previous code had unlikely code path where change of pool settings url
will cause form validation to be set up again and again etc...

In order to avoid that improbable bug I'm adding code to destroy
previous instance of form validation prior to overwriting it with new
instance.

Change-Id: I06f47903dc7e90dc66fba5858e220c421ffa1b1d
MB-9552: reduce message passing in XMem

Today in XMem XDCR, the vb replicator rep_worker process need to
send all docs to replicate to xmem_server process first, and the
xmem_server process will pass all these docs to its child xmem_worker
process. Consequently there are two big message passing among Erlang
processes which may cause some inefficiency.

This commit will make rep_worker process send all docs to replicate
directly to xmem_worker process and flush to remote. Therefore it
removes the first message passing above and initial XDCR test on
toybuild shows more than 15% throughput improvement.

Change-Id: Iccf3ab02137b30d9f9bdd5c41c6d168ec7f93da0
MB-9596: improved rebalance diagnostics

In MB-9596 logs it's not clear exactly why replica builder
shutdown_replicas call failed. And it's also obvious that entire
sequence of actions by single vbucket move is not logged very
clearly. This commit addresses it.

Change-Id: Iea7af5e5128a635d5dfeb5cd02164e7a0ae7a25a
Merge "added scripts/memory_monitor.sh" into for-rackaware
Merge "correctly json-format errors from remote clusters POST" into for-rackaware
MB-9339: changed menelaus_rest to use lhttpc

We'll need this in order to move remote_cluster_info facility to xdcr
connection pool.

Change-Id: I337864646dfbab897967b90f0816fcc265491de5
MB-9339: use xdcr lhttpc pool for remote_clusters_info requests

Change-Id: Ibf607fd4131546e604148b27e8b9b08589746c5a
MB-9339: amputate xmem checkpointing mode

because it will not be supported by xdcr-over-ssl

Change-Id: I915f9a4eec835bd9032da05f589bec5ca072e7fb
MB-9339: support success in mc_client_binary:map_status

Change-Id: I82b064ee33b1630db43a95b4d23f34b14bf8c8af
MB-9339: introduced ns_connection_pool

Change-Id: I8e509a6459a88f536a087b86296c1d09f4eee37b
MB-9339: added pooled_memcached_client and memcached_clients_pool

Change-Id: I64473163306b12fb9a1b5ef1fba33d841801da86
MB-9339: use pooled_memcached_client for xmem

Change-Id: I79c5341188b06050f1a8033508fc0296d4c93421
Merge remote-tracking branch 'origin/for-rackaware'

* origin/for-rackaware:
  MB-9339: use pooled_memcached_client for xmem
  MB-9339: added pooled_memcached_client and memcached_clients_pool
  MB-9339: introduced ns_connection_pool
  MB-9339: support success in mc_client_binary:map_status
  MB-9339: amputate xmem checkpointing mode
  MB-9339: use xdcr lhttpc pool for remote_clusters_info requests
  MB-9339: changed menelaus_rest to use lhttpc
  MB-9596: improved rebalance diagnostics
  MB-9552: reduce message passing in XMem
  un-leak memory in cluster settings form validation code
  MB-4557: Allow changing cluster ram size from UI
  correctly json-format errors from remote clusters POST
  added scripts/memory_monitor.sh
  MB-9556: reduced acc management font
  MB-100: no need to replicate if srcMeta = destMeta
  MB-9589: handle incomplete cluster leave

Conflicts:
	src/ns_single_vbucket_mover.erl

Change-Id: I80fc15ecbabc1c33ffa802bb1f8f1ea940234bcd
MB-9643 hibernate ebucketmigrator_srv after timeout

- hibernate also upstream_sender
- do not hibernate during the backfill

Change-Id: I92dd4b309851ef379f55fb05d93efd0cfe1310f2
Merge "MB-9643 hibernate ebucketmigrator_srv after timeout" into for-rackaware
Create install/bin earlier

Create the install/bin directory before it is used
the first time.

Prior to this change it made the buildbot fail [1].

[1] http://factory.couchbase.com/view/commit_validation/view/couchdb/job/couchdb-gerrit-views-pre-merge-master/71/console

Change-Id: If9b7ede8ea86d2d9307899b8a203a91d2c04552d
MB-9477 change max value of purge interval back to 60 days

Change-Id: Idd9d6826b47115a117f27fa30864b50733dec35c
[cbcollect_info] couch_dbdump _replicator docs

Change-Id: If65de892c0fc1702506176672bcc3c550efe48ed
MB-9612: handling remote_cluster_info error more gracefully

Today during vb replicator initialization, if remote_cluster_info
fails to grab remote bucket info for any reason, the vb
replicator will crash on a badmatch error and the throttle
will reschedule the next waiting one. This immediate-retry-
after-failure behavior may cause more repeated errors from
remote and vb replicators at source side may crash repeatedly
for nothing.

This commit will make vb replicator consume the error from
remote_cluster_info. If any error returns, the vb replicator
will pause for sometime (default is 30 seconds), and re-query
remote_cluster_info. If the TMP error at remote resolves in
30 seconds, the vb replicator will continue initialization
without crash. If the error persists after 30 seconds, XDCR
will not be able to start as expected.

Change-Id: I39921754887686c0b969b53eb0e4a5764b385145
Merge "MB-9612: handling remote_cluster_info error more gracefully" into for-rackaware