MB-9457: pass swt low to child erlang

I.e. to spread all load to all cores quicker

Change-Id: I7940afa9f1e5a2796122926796490ca55808f4d0
Reviewed-on: http://review.couchbase.org/29994
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-8726: implemented ns_memcached:set_cluster_config/2

Change-Id: I85fd65da02a073fd867ce11ee2ca3969ed6c46c5
Reviewed-on: http://review.couchbase.org/29995
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-8726: implemented terse bucket details REST API

And facility to cache those terse bucket details.

New url endpoints are /pools/default/b/<bucket-name> and
/pools/default/bs/<bucket-name>. The later is streaming one.

New endpoints are HATEOAS-discoverable. /pools/details now contain
buckets.terseBucketsBase (and terseStramingBucketsBase
correspondingly) field. That field advertises "prefix" to terse bucket
details urls: /pools/default/b/. HATEAOS client needs to append bucket
name to this string and it'll get path to GET in order to receive
terse bucket details (or streaming bucket details
correspondingly). Such approach of avoiding buckets list request
shortens bootstrap and enables mega-buckets concept.

This bucket details response contains "useful" subset of fields of
usual bucket details response. I.e. it only contains fields that
matter for smart clients and omits everything else. Response is
exactly same as output from CCCP-aware memcached on not-my-vbucket
condition. Notable difference is that it also works for memcached
buckets.

Only major difference with parsing existing bucket details, is that in
order to send same output as CCCP-aware memcached, ns_server does not
replace 127.0.0.1 in hostname fields with address that's serving
response. @@ marker string is sent instead of 127.0.0.1. So hostname
would be "@@:9000" and couchApiBase - "http://@@:9500/default". Clients
are expected to be smart enough to perform that replacement.

Here's how typical terse bucket details look:

{
    "name": "default",
    "nodes": [
        {
            "couchApiBase": "http://chi.local:9500/default",
            "hostname": "chi.local:9000",
            "ports": {
                "proxy": 12001,
                "direct": 12000
            }
        },
        {
            "couchApiBase": "http://chi.local:9501/default",
            "hostname": "chi.local:9001",
            "ports": {
                "proxy": 12003,
                "direct": 12002
            }
        }
    ],
    "nodeLocator": "vbucket",
    "uuid": "ba07a6a720a2631279d743081d5ce2fd",
    "bucketCapabilitiesVer": "",
    "bucketCapabilities": [
        "touch",
        "couchapi"
    ],
    "ddocs": {
        "uri": "/pools/default/buckets/default/ddocs"
    },
    "vBucketServerMap": {
        "hashAlgorithm": "CRC",
        "numReplicas": 1,
        "serverList": [
            "chi.local:12000",
            "chi.local:12002"
        ],
        "vBucketMap": [
            [
                0,
                1
            ],
            [
                0,
                1
            ], ....
        ]
    }
}

Change-Id: Id255ffce40d3cf2bd88919d4b683ec1273563be2
Reviewed-on: http://review.couchbase.org/29996
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-8726: implemented upload of terse bucket infos to ep-engine

Change-Id: I8f0a3fea054d1b4a58cc93707e38dc3420fa523a
Reviewed-on: http://review.couchbase.org/29997
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-8726: added vclock:count_changes

Change-Id: Ic44479049d0484a44a1945614c6f3e878b4766c5
Reviewed-on: http://review.couchbase.org/29998
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-8726: added ns_server:search_with_vclock/2

Change-Id: I21747b5ad06807d493d0a20f59795874cf30aee7
Reviewed-on: http://review.couchbase.org/29999
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-8726: added rev field to terse bucket details

rev field can be used to compare bucket details from different nodes
for freshness.

vclock _of all buckets_ is used to compute that. Simply because we
don't have vclock per bucket.

That makes rev field a bit weird. Same bucket details may have
different rev depending on when they where cached. But what really
matters is that fresher bucket details will always have greater rev
field. Which is what we really need.

Change-Id: Iad5ec27d40e482501f91bb690b6c9c80948a77ad
Reviewed-on: http://review.couchbase.org/30000
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-1143: initial server groups UI

Change-Id: Ifa3984c24f08720877139666656866642ab9b217
Reviewed-on: http://review.couchbase.org/29661
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-1143: revise groups UI to build servers cell from pool details

Because pool details are refreshed constantly in order to get fresh
server stats. And because we only need groups cell to reflect
server-group relation.

Change-Id: I7128fbe54b8fb194fdc01fd1737babec848dfe1c
Reviewed-on: http://review.couchbase.org/30037
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
casperjs tests for server groups

Change-Id: I2159747183013be1869a9b6e36284470a22a6194
Reviewed-on: http://review.couchbase.org/30024
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-9412: sanitize bits of config logged from conflict resolution

I.e. so that passwords are not leaked this way

Change-Id: Iec8411681578b344c353c43e4ed5a88c37ab11c1
Reviewed-on: http://review.couchbase.org/30038
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-9432: fixed descr. of vb_pending_resident_items_ratio stat

Change-Id: If62bb2ab1486306679f38cbc01b323a361620632
Reviewed-on: http://review.couchbase.org/30061
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-945{6,8}: trim and validate group name for length

Change-Id: Icd118dd30d4ec6c457229c73c87fb490bd84bcfa
Reviewed-on: http://review.couchbase.org/30062
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-100: detect forceVersion even when it's not last parameter

Change-Id: If21e2d42e46bdef6726743eb93c9ae3f268e05fb
Reviewed-on: http://review.couchbase.org/30063
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-8726: updated localhost marker to $HOST

Based on people's feedback

Change-Id: I2c3165936678607cbd1cc548ca287a01ccdfbccf
Reviewed-on: http://review.couchbase.org/30067
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Merge branch 'for-rackaware'

* for-rackaware:
  MB-8726: updated localhost marker to $HOST
  MB-100: detect forceVersion even when it's not last parameter
  MB-945{6,8}: trim and validate group name for length
  MB-9432: fixed descr. of vb_pending_resident_items_ratio stat
  MB-9412: sanitize bits of config logged from conflict resolution
  casperjs tests for server groups
  MB-1143: revise groups UI to build servers cell from pool details
  MB-1143: initial server groups UI
  MB-8726: added rev field to terse bucket details
  MB-8726: added ns_server:search_with_vclock/2
  MB-8726: added vclock:count_changes
  MB-8726: implemented upload of terse bucket infos to ep-engine
  MB-8726: implemented terse bucket details REST API
  MB-8726: implemented ns_memcached:set_cluster_config/2
  MB-9457: pass swt low to child erlang

Conflict-less merge

Change-Id: I2e775b8506ad3220c31ff599a4f9e344af1f8f04
MB-100 Fix false failover warning.

Which appeared because misc:uniqc expects sorted input.

Change-Id: Ib183352c6915b6b852b77569ffd17b1c3cfa4204
Reviewed-on: http://review.couchbase.org/30077
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Artem Stemkovski <artem@couchbase.com>
MB-100 Add missing space.

Change-Id: I1d41790519d2dfdb60882da009479b90db3a0a2e
Reviewed-on: http://review.couchbase.org/30071
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Artem Stemkovski <artem@couchbase.com>
MB-100 Don't log vclock twice when conflict happens.

It's part of the raw value. So it was logged twice introducing certain
confusion.

Change-Id: I071c238c39d4e994c0740bac15df51f8e6663b51
Reviewed-on: http://review.couchbase.org/30072
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Artem Stemkovski <artem@couchbase.com>
MB-100 Simplify ns_config:merge_kv_pairs.

I removed the case that is perfectly handled by merge_list_values
already. And I'm not sure hitting this case is even possible. In
addition to that I renamed merge_list_values accordingly.

Change-Id: If988d7c1258c4fd07c4c27b3972651f02504487e
Reviewed-on: http://review.couchbase.org/30073
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>