MB-6277 Ignore initial_build view compaction errors.

Change-Id: If4c0e9708f8e1a16e40380ca2094df98646b89b4
Reviewed-on: http://review.couchbase.org/20024
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-6342 Restart view compaction when getting shutdown errors.

Different flavors of 'shutdown' error means that compactor has been
restarted inside couch_set_view_group because set view state has been
changed. This usually happens during rebalance. In such case
couch_set_view_compactor:start_compact would return new PID of
compactor. There's a small chance that by calling start_compact we
will actually start new compaction. But we'll ignore this for now. In
case it turns out to be a real problem, we'll be able to fix it by not
restarting compactors inside couch_set_view_group.

Change-Id: If2d5299f714a5574fbbc97a4be9447cb50fe84a4
Reviewed-on: http://review.couchbase.org/20025
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5308 Group progress bars by type.

Rebalance progress will always be shown first. Then will go indexing,
bucket compaction and finally view compaction. Inside each group tasks
are sorted by bucket and design document name (if applies).

Change-Id: If7932980cdf4a047e439330a1e7cc39c3bef60f9
Reviewed-on: http://review.couchbase.org/20026
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307 Upgrade all known memcached log parameters.

Change-Id: If4279f5c9975cf128aa61107bcd19e34d4968bde
Reviewed-on: http://review.couchbase.org/20027
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307 Use cluster UUID instead of name in remote references.

So that if remote cluster reference gets renamed, replication
documents don't have to be changed.

Change-Id: I30b8f0a161fc1f9f8df45d7f32ef2f8f8db77826
Reviewed-on: http://review.couchbase.org/19369
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307 Don't actually remove remote cluster references.

Since it's not easy to reliably remove all the replications when
cluster reference removed (or alternatively, it's hard to disallow
removing cluster reference when there're still existent replications),
we decided not to remove cluster references. Instead they are marked
as deleted and are not shown on the UI.

We enforce two invariants on remote clusters lists:

  1. For every UUID there's only one cluster (both deleted and not
  deleted) with such UUID in the list.

  2. For any cluster name there's only one not deleted cluster with
  that name.

On the UI if remote cluster reference for some replication is deleted,
we show remote cluster's hostname instead of cluster reference
name. That's because when it comes to deleted references, the name is
not unique anymore.

Change-Id: I1c2540f288462275291b8bf37648f3f03842aebc
Reviewed-on: http://review.couchbase.org/19460
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5911 Choose replication documents ids deterministically.

Previously replication document id was generated randomly. From now
it's comprised of remote cluster UUID, local bucket name and remote
bucket name. So this effectively disallows having duplicate
replications.

Replication creation API has been slightly changed: instead of
returning replication document body to be posted to replication
database, everything is done by the handler of the createReplication
itself. On success result object will contain an id of created
replication document and an URI to _replicator database.

Change-Id: I1e07c125061935662ea7d9fc32752e51d52cd5f1
Reviewed-on: http://review.couchbase.org/19370
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5911 Best effort check to disallow duplicated replications.

Since now we have deterministic ids for replication documents, we just
check if replication document with the same id already exists. But
this check is not race free. Virtually, such a replication document
can be replicated from other node after the check's already been
performed. But with deterministic ids we at least won't create other
replication but rather overwrite existing one.

Change-Id: I7b85322122e5e80d4699b87736f2f9577d9dbbe7
Reviewed-on: http://review.couchbase.org/19371
Reviewed-by: Junyi Xie <junyi.couchbase@gmail.com>
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-6372 Use valid EJSON for task statuses.

This unbreaks _active_tasks.

Change-Id: I57efd655d6a13d49020e6a2b44a31c3955021ab0
Reviewed-on: http://review.couchbase.org/20028
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-4454 Suppress error_logger and sasl tty handlers early.

Previously we would remove sasl and error handler in
cb_init_loggers. But some processes would have already started by that
time. And thus some output would already be produced. This can be
prevented by setting error_logger and sasl_error_logger parameters
appropriately.

Note that mnesia still produces some undesired tty output. We will
likely just get rid of it entirely.

Change-Id: I3a35a74df01ccbe9446484377a50b95f516c4b42
Reviewed-on: http://review.couchbase.org/20029
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-6371 Check if forced compaction is already running correctly.

Change-Id: Ib62cc7d43917e40efff99f07979387354d93b725
Reviewed-on: http://review.couchbase.org/20030
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307 Try to discover master on alive nodes (excluding us).

It doesn't make sense to try to discover master on our own node. It
will just result in noproc error. Additionally, to avoid confusing
errors we will not try to discover master on nodes that we know are
down.

Seen in MB-6371.

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