Use master database to find design documents

Currently all design documents reside only in the master
database, therefore the existing code was not compacting
views because it was checking for design documents in the
data vbucket databases.

This is for MB-4210.

Change-Id: I626a2492ac2344a4ebba6c6002bdb60959babe68
Reviewed-on: http://review.couchbase.org/9145
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Compaction daemon's config change handling

Using an exported function prevents odd issues with OTP's
dynamic code reloading.

Change-Id: I67f7d887faf3c2e143681938241f58d61d329750
Reviewed-on: http://review.couchbase.org/9146
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Update compaction daemon's config format

The .ini configuration values are now an Erlang term -
a list of 2 elements tuples, instead of K=V pairs separated
by spaces. This is to make it consistent with the rest of
the .ini configuration.

Change-Id: I1d50ed47d1e5b1ab715cf595bf2287495996c8a5
Reviewed-on: http://review.couchbase.org/9147
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-4215 Ignore empty pool details.

When pool details are undefined then UI changes correspondingly:
spinners appear and some of the buttons disappear. So it's very
unlikely to encounter a situation when poolDetails.value is
undefined. Thus we just ignore this.

Change-Id: I46ac38d5603c15440119ec0454a8a7a78da140e3
Reviewed-on: http://review.couchbase.org/9153
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Merge remote-tracking branch 'membase/branch-171' into branch-20

* membase/branch-171:
  MB-3945 Fix replicas promotion after failover.
  MB-4180 Fix grabbing diag.
  save config after config cas. MB-4186
  MB-3961 Work around inet:getiflist() bug under multi-home

Conflicts:
	src/menelaus_web.erl

Change-Id: I00eff732c5a3f911130af8434c636dc27ceb3752
Fix get_version() type spec.

Change-Id: Ic20d78164d8087cb784dea8f241d7614f42b8032
Reviewed-on: http://review.couchbase.org/9178
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Merge "Merge remote-tracking branch 'membase/branch-171' into branch-20" into branch-20
MB-4220 Wait for all nodes on bucket deletion.

Currently bucket creation and deletion operations are asynchronous
which causes races under certain conditions. This commit makes bucket
deletion synchronous. To make bucket creation synchronous one must
wait until janitor run is completed which requires major rework of
ns_orchestrator. So now this is put off.

Change-Id: Id13bb793cd63e86f0e8aaf5104005c4fb5c39c62
Reviewed-on: http://review.couchbase.org/9193
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Restart moxi on bucket deletion.

This is needed since moxi keeps a pool of downstream connections. Some
of these connection become invalid when bucket is deleted. Thus error
will be reported to the client in case such stale connection is reused.

Change-Id: I86ad2b047669db13bf3c7917b43d92be5e6cce43
Reviewed-on: http://review.couchbase.org/9194
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Add initial vclock to per node keys that changed since 1.6.5.

This change fixes MB-4219.

When config merging routines encounter two values not having vclocks
attached to them then the value that came from remote node is
chosen. This can cause certain races. Particularly this is the cause
of upgrade issues seen on windows: when node is started for the first
time it upgrades old config but then it pulls the config from other
nodes and prefers foreign value (outdated one) to its own. This change
introduces initial vclocks for such vulnerable keys so that new values
will be preferred.

Change-Id: Ibe85213eb8df2392f6b4b34413062c0aed19c0a1
Reviewed-on: http://review.couchbase.org/9206
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
unbreak serializeForm w.r.t. fields order

This makes it's behavior consistent with what browsers do when they
see duplicate input names in forms (preferring later inputs, as
utilized by rails checkbox helpers).

Change-Id: I148b5cc5b1baed7d9d36246999b76631f0ce621f
Reviewed-on: http://review.couchbase.org/9181
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
handle errors from phone home calls

Change-Id: I70ba6a4bd14980734da5099e281603d1f0bcc4f8
Reviewed-on: http://review.couchbase.org/9182
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
refactored cb_config_couch_sync into separate gen_server process

So that it doesn't block ns_config_events process.

Change-Id: Ie664ab249066abba83965ec52751c7da2d5025ae
Reviewed-on: http://review.couchbase.org/9183
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
implemented REST API for autocompaction settings

This code only implements changing of ns_config values and serving
autocompaction settings with pool and bucket details. This work also
includes complete server-side validation.

Change-Id: Id41564006548f8b0c5cd1cfdf6c3511b95e2fdb9
Reviewed-on: http://review.couchbase.org/9184
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
update pool details when autocompaction settings change

Change-Id: I4ee3e114a2236b345d19e5d514697db2680c5dce
Reviewed-on: http://review.couchbase.org/9185
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
implemented couch config sync for autocompaction settings

Change-Id: I28430898281e147f7d487dbb1005c99d294012da
Reviewed-on: http://review.couchbase.org/9186
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
removed unused Cell.computeListDetails

Change-Id: I0cdcb4c55229b600765db44accd6b382328dbf47
Reviewed-on: http://review.couchbase.org/9187
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
force reloading of bucket details for details dialog

Change-Id: I355063b21ba28fd1cec9c33135b9645ac0d2ccb0
Reviewed-on: http://review.couchbase.org/9188
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
correctly cleanup bucket details form changes observers

Change-Id: Ib96615c027dc662b2f53a9e0613f280c68b4b060
Reviewed-on: http://review.couchbase.org/9189
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
made scrolling of screen in showDialog faster

Because 250 millis is annoyingly slow. It's too easy to try scrolling
it with wheel only to be 'resisted' by animation.

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