MB-7824 Hibernate ns_log and ns_log_sink.

ns_log expects messages to be strings. And it's not easy to change it
to work with binaries because of backward compatibility issues. So
instead we just hibernate ns_log and ns_log_sink. Since we don't frequently
log to the ns_log, this should not cause any performance issues.

Change-Id: I1a1fbf2cea9ce4ef300846c86eb2f714c26b5710
Reviewed-on: http://review.couchbase.org/24910
Reviewed-by: Junyi Xie <junyi.couchbase@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-7786 Group concurrent remote bucket requests.

When XDCR replication is created, every vbucket replicator calls
remote_cluster_info:get_remote_bucket_by_ref about the same time. At
this only one remote node is known. Namely, the one that was used to
create remote cluster reference. Previously remote_clusters_info did
not attempt to group all these concurrent calls into a single request
to the remote node. Which could lead to the overload on the
destination node. This would produce an error. Replicators would
retry and most likely hit cached value. So replication would start
without any issues. But the error is reported to user and creates
certain confusion.

To lower the probability of overloading any of destination nodes,
remote_clusters_info will not make more than one outstanding request
per node per remote bucket. So for the case described earlier, only
one remote request will be performed for all the simultaneous
get_remote_bucket calls.

Change-Id: I9ca0bb0dba5670c545f824d00ebaff9cf331ac06
Reviewed-on: http://review.couchbase.org/24986
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307 Properly validate usernames and passwords.

Change-Id: Id46f42f20cde19a1733fece9de27d16316302013
Reviewed-on: http://review.couchbase.org/24998
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307 Handle colon in passwords correctly.

Change-Id: Id9f23a8f3a58906c1fc393f0469d5d27d3d6663d
Reviewed-on: http://review.couchbase.org/24999
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-100: render visualize-rebalance timeline in real scale

So that it's easy to compare different runs.

Change-Id: I08282039cf7e5fc1895f8648d5e767843d256575
Reviewed-on: http://review.couchbase.org/25002
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-100: stop messing with timer_server on stats messages

Old code of killing reader or archiver is some messages handling takes
60 seconds or more was to handle mnesia issues. Given mnesia is gone,
we don't need this stuff. And I've seen timer_server at top of etop
list. After this fix it's better.

Change-Id: I3ed9f17c616930f48d73ff70289eeb8a980d90d0
Reviewed-on: http://review.couchbase.org/24618
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-100: fixed stats timestamp logging

We were incorrectly converting timestamp into local time. Found by
code inspection during CBSE investigation.

Change-Id: I63a2d3654414d04fc9b20b3b4146e3ef1a764165
Reviewed-on: http://review.couchbase.org/24639
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-7670: avoid key order order change in ns_config:update

do_update_rec is processing config pairs in normal order, but prepends
result. Thus it's reversing order of pairs. Thus we're returning
correct order in the end by reversing it again.

Change-Id: Ic9aabfa89dd62e6f8e2481dd3c66f363748e650d
Reviewed-on: http://review.couchbase.org/24640
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-7670: don't save config on empty changes

We've found that janitor's use of ns_config:update caused frequent
saving of same config.

Change-Id: I26ea744767f0daccf77b30ed3fe1d4f63e6206f2
Reviewed-on: http://review.couchbase.org/24641
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-100: clean up timer's kill_after timers

Otherwise they accumulate and cause increased cpu load.

Change-Id: Ic632220e7c257ca9d9f3107a1dcf5f3edc2e23a4
Reviewed-on: http://review.couchbase.org/24642
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-100: introduced ns_config:search_quick/1

Not sure new _additional_ API is good idea, however.

Change-Id: I6579b98a59c11437cf0d857de6ad25ca0e5ce214
Reviewed-on: http://review.couchbase.org/24643
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-100: use quick version of cfg access to check rebalance_status

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