MB-5417: fix spatial view alignment in UI

Change-Id: Ie68a81da4a06ab5b1afdc3887cf72d47cc8cf572
Committer: tommie@couchbase.com
Reviewed-on: http://review.couchbase.org/16621
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-4835: ui typo in delete view text

Change-Id: I439a07eb8c1ecb892956bc31783f145930de8c63
Reviewed-on: http://review.couchbase.org/16622
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Simplify capi_crud for the UI to use non-CAS APIs and ignore _revs

This makes the user experience more like the memcache semantics
we offer in the developer APIs. Ideally we'd make a CAS operation
option available in the UI, but first we will simplify, then we
can add those advanced features.

Change-Id: Iaf240a9ed0da0b1094713f179c04c356d529f4c8
Reviewed-on: http://review.couchbase.org/15978
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5402:fp: avoid system_stats_collector crashing other services

System stats gathering is a cool thing. But MB-5402 points out that
sometimes we want to count some stats quite before
system_stats_collector configured ets table for stats. We're just
ignoring any exceptions from trying to update those stats now.

Change-Id: I566a8217beb217b4ff30f13627c9235b2738c183
Originally-Reviewed-on: http://review.couchbase.org/16632
Reviewed-on: http://review.couchbase.org/16784
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307 Use more descriptive names for unique_random_ints args.

Since it's pretty easy to confuse N and R (at least for me).

Change-Id: I2ed73434692333363b56ea5568a309f7aa1c6c3b
Reviewed-on: http://review.couchbase.org/16795
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307 Really avoid infinite loops in unique_random_ints.

It seems that because of not very good argument names Range and
NumSamples were just swapped in unique_random_ints/2.

Another subtle issue was that [Var] <- [Binding] in list comprehension
does not seem to work as it was expected:

  [I || I <- lists:seq(1, 10), [True] <- [true], True =:= true] yields []

Change-Id: I52d962ccfab480bac3ef808721169516b6490c74
Reviewed-on: http://review.couchbase.org/16796
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
CBD-323 Handle zero number of samples when aggregating size.

Change-Id: Ib50d8a1ed162065b7074213e49046f7027b22594
Reviewed-on: http://review.couchbase.org/16797
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
CBD-312 Index merger is now a separate OTP application

Change-Id: Ibe9b107aa7bb21181f6643ca51b9ce325689e3fb
Reviewed-on: http://review.couchbase.org/16588
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Damien Katz <damien@couchbase.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Check for passwords on REST bucket access

Use menelaus_auth to determine if the REST request has
valid credentials. This works for basic auth via curl
as well as in the admin console. It is also vbucket
aware and will require passwords for direct vbucket
access by XDCR client.

Change-Id: I93fb39cc56c2e2be2b5f3500d4eca93e6871abdd
Reviewed-on: http://review.couchbase.org/16727
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Chris Anderson <jchris@couchbase.com>
Merge commit '27fbb5333af2...' into branch-18

* commit '27fbb5333af28875037c17f308f2e6d39913d6a7':
  MB-5307:ebucketmigrator:dont ask password when not given username
  MB-5307: unbreak cli ebucketmigrator
  MB-5307: allow just grabbing current archive of master events
  MB-5402: avoid system_stats_collector crashing other services
  MB-5203 Include diag in collect_info
  MB-5307: support simple way to adjust some timeouts at runtime
  MB-5408: use pool of ns_memcached workers to handle requests

This merge was trivial

Change-Id: Ib981183ecf80ebb7cbb21dd2015c71ca49597391
MB-5307: made ns_vbm_sup:apply_changes only touch affected nodes

This is 're-make' of commit '96b7e01a87478449f68225138d5564f75184c760':

Change-Id: I9992e0ec5a3d7709e09c110d07476b030f13d3fb
Merge remote-tracking branch 'origin/branch-181' into branch-18

* origin/branch-181:
  MB-5307: only replicate locally made config changes
  MB-5434: don't add ejected nodes back to bucket's servers list
  MB-5307: implemented exponential backoff for replicas building
  MB-5307: optimized ebucketmigrator network delays
  MB-5307:implemented more efficient ebucketmigrator initialization
  MB-5307:ebucketmigrator: use prim_inet instead of gen_tcp
  MB-5307: impl. more efficient check for ebucketmigrator timeout
  MB-5307: skip ebucketmigrator sasl auth step for default bucket
  MB-5307:refactored ns_port_init to avoid excessive recomputations
  MB-5307:saslBucketsStreaming now avoids sending whole node status
  MB-5307: don't compute saslBucketsStreaming twice on each update
  MB-5307: menelaus_web:handle_streaming now eats all notifications
  MB-5307: dont hibernate gen_events
  MB-5307: support slow network simulation for cluster_run

Conflicts:
	src/ns_rebalancer.erl

Conflict was minor.

Change-Id: Ib96fecf1cdd4936304248caca7a9cd409bfafaa6
MB-5307: don't allow duplicate nodes in apply_changes

This fixes bug introduced by the following merge
c58f1d76c012d61ecb298c50238ae4605ad4b273.

It wasn't failing anything visibly, but was applying vbucket filter
changes multiple times.

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

* origin/branch-181:
  MB-5307: use fully expanded port server args to detect changes

Merge is trivial

Change-Id: I357942f473e44d818bccd51786c2c984e89808fa
Merge commit '0f1ba120aa64d707417b034a36381fd1d1602843'

* commit '0f1ba120aa64d707417b034a36381fd1d1602843':
  MB-5408: use pool of ns_memcached workers to handle requests

Empty commit because actual change is forward-ported separately.

Change-Id: I801e6313db283bc602d61406ef6b15c5d53182aa
Merge branch 'branch-18'

* branch-18:
  MB-5307: use fully expanded port server args to detect changes
  MB-5307: don't allow duplicate nodes in apply_changes
  MB-5307: only replicate locally made config changes
  MB-5434: don't add ejected nodes back to bucket's servers list
  MB-5307: implemented exponential backoff for replicas building
  MB-5307: optimized ebucketmigrator network delays
  MB-5307:implemented more efficient ebucketmigrator initialization
  MB-5307:ebucketmigrator: use prim_inet instead of gen_tcp
  MB-5307: impl. more efficient check for ebucketmigrator timeout
  MB-5307: skip ebucketmigrator sasl auth step for default bucket
  MB-5307:refactored ns_port_init to avoid excessive recomputations
  MB-5307:saslBucketsStreaming now avoids sending whole node status
  MB-5307: don't compute saslBucketsStreaming twice on each update
  MB-5307: menelaus_web:handle_streaming now eats all notifications
  MB-5307: dont hibernate gen_events
  MB-5307: support slow network simulation for cluster_run
  MB-5307: made ns_vbm_sup:apply_changes only touch affected nodes
  MB-5307:ebucketmigrator:dont ask password when not given username
  MB-5307: unbreak cli ebucketmigrator
  MB-5307: allow just grabbing current archive of master events
  MB-5402: avoid system_stats_collector crashing other services
  MB-5203 Include diag in collect_info
  MB-5307: support simple way to adjust some timeouts at runtime

Conflicts:
	CHANGES
	cbcollect_info
	cluster_run
	src/ns_memcached.erl

Change-Id: I5d6b2ba697003a3126e2f3b41aeda28a84f7562f
MB-5449 Don't crash miserably on views without replica index.

Change-Id: Iec255177a8d0bb487e14c3f53c24b2feeb2104e2
Reviewed-on: http://review.couchbase.org/16863
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307 Make bucket_databases/1 a bit more efficient.

Avoid building potentially big list of all databases. Just do fold.

Change-Id: Ifbe8c2b7e0582e5b6bbca32e2b2d890b8df8de6c
Reviewed-on: http://review.couchbase.org/16866
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5449 Avoid intermittent no_db_file crashes.

We tend to create vbucket databases slowly. Thus to prevent loads of
{not_found,no_db_file} crashes we'll first check that all databases
exist. If not then we'll skip compaction of this bucket. We don't
expect such a state to last long thus such approach looks acceptable.

Change-Id: I3e9c61930ecdebcf7c2444df8f8763c2cd01f218
Reviewed-on: http://review.couchbase.org/16867
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5459: Revert "Check for passwords on REST bucket access"

This reverts commit 5f5fe375b2d85444596818516d501d0c1cce8685.

Reverted change breaks access to _replicator database breaking XDCR
badly

Change-Id: Ie1739bcd60157cf6dd5e2c3edf80a56657878185
Reviewed-on: http://review.couchbase.org/16885
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>