MB-5307: removed vb mover replication changes accumulation code

Because it's useless since we've started doing reliable replica
building.

Change-Id: I3d9bacb225a4c10b6dbda3c2af5c585dd9cafaef
Reviewed-on: http://review.couchbase.org/18210
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5307: removed bogus 'support' of rebalancing memcached buckets

Vbucket mover accidently got code that depends on bucket type. We
don't really need that as memcached buckets are using consistent
hashing.

Change-Id: I115aa1cef2e0c4cedbaea666b099bb0f12f14ca9
Reviewed-on: http://review.couchbase.org/18211
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5307: dont dialyze geocouch

Because it's failing anyways.

Change-Id: Ia55f0ea5d4ae58662617a906a1f7997bd3590032
Reviewed-on: http://review.couchbase.org/18212
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5307: removed unused xdcr capi function

Change-Id: I41c61970cffe1802315a386f4b3fc4cca17a7cce
Reviewed-on: http://review.couchbase.org/18213
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5307: prevent spamming of logs by useless empty xdcr stats

Change-Id: Ia0635b83728fc61debd453ada7a5af18a93c13ce
Reviewed-on: http://review.couchbase.org/18214
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5689: rm-rf all bucket's files when deleting it

It's not enough to just delete databases, because there's also
access.log and other stuff, so we just rm-rf directory.

As part of this commit I've also changed error logging to be visible
in user-level logs.

Change-Id: I93de1162d0aa1353d502504bf1c438d31fa81738
Reviewed-on: http://review.couchbase.org/18215
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
CBD-399: remove unsupported replication in replication worker

In XDCR, all replications come with target #httpdb{} while all
sources are passed as #db{}. In function local_process_batch,
the source and target must be #db{} and #httpdb{} respectively.
This change-set will remove unused code and add log in function
find_missing().

Change-Id: I256024c5e97fdded0aac5ea8265ba317362c4207
Reviewed-on: http://review.couchbase.org/18185
Reviewed-by: Junyi Xie <junyi.couchbase@gmail.com>
Tested-by: Junyi Xie <junyi.couchbase@gmail.com>
CBD-399: simplify conflict resolution in capi_replication

Today conflict resolution code in capi_replication is confusing and
unnecessarily complex. This change-set uses plain comparison to
simplify winner picking and removes unused code.

Change-Id: Iad96a2b95acbf47ff124b725926f59ff4c47ebec
Reviewed-on: http://review.couchbase.org/18201
Reviewed-by: Junyi Xie <junyi.couchbase@gmail.com>
Tested-by: Junyi Xie <junyi.couchbase@gmail.com>
CBD-399: remove unused function clause in replication worker

Change-Id: Id4166996e9fde3444c4b91c6390f5432c1fd889c
Reviewed-on: http://review.couchbase.org/18309
Reviewed-by: Junyi Xie <junyi.couchbase@gmail.com>
Tested-by: Junyi Xie <junyi.couchbase@gmail.com>
MB-5307 Improve ns_pubsub logging.

Old messages where mostly of no use because it was very hard (if not
impossible) to understand to whom they belonged.

Change-Id: I706d49956d5776cd610d84f45d7940f00c8dafb3
Reviewed-on: http://review.couchbase.org/18330
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5877 Don't leave hanging ns_port_server processes.

ns_port_server traps exits and it's cushioned by
supervisor_cushion. This means that if ns_port_server hangs somewhere
in terminate function, it won't be killed by supervisor even after
timeout specified in the child spec exceeded. Only EXIT message from
supervisor_cushion will be delivered to it but it won't be handled. To
avoid such situations from now supervisor_cushion processes must be
started with timeout of infinity. But supervisor_cushion:start_link
now has additional parameter specifying how long to wait for sane
termination of the cushioned process.

Change-Id: I8462a0d5b1de2608b1e4c56461f1070e586d97ef
Reviewed-on: http://review.couchbase.org/18331
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
CBD-425: Add logger for errors during the MapReduce

Change-Id: I062679e3cf7a2e0fbf5658a1daaeacbecfd60dc4
Reviewed-on: http://review.couchbase.org/18292
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Revert "MB-5877 Don't leave hanging ns_port_server processes."

This reverts commit aa93b64eb5ae19a1ee424109d09d7be281bc3438.

Server crashes in startup due to:

=========================CRASH REPORT=========================
  crasher:
    initial call: supervisor:ns_server_sup/1
    pid: <0.367.0>
    registered_name: []
    exception exit: {start_spec,{invalid_shutdown,infinity}}
      in function  gen_server:init_it/6
    ancestors: [ns_server_cluster_sup,<0.63.0>]
    messages: []
    links: [<0.185.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 233
    stack_size: 24
    reductions: 1443
  neighbours:

Change-Id: I0fb77c7acd78ec593868b59cb6b9197226e8b0e5
Reviewed-on: http://review.couchbase.org/18343
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Revert "Revert "MB-5877 Don't leave hanging ns_port_server processes.""

This reverts commit 43b8dcc1ebefc06b6d9b7596c1a86e920ca6dc32.

Change-Id: I74acd87998c150ce637005631c6c672f89979f5f
Reviewed-on: http://review.couchbase.org/18351
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5877 Don't use infinity shutdown spec for worker processes.

OTP prior to r15 does not support this.

Change-Id: If562833beceb7cad2a54d229412431ac6c7d24e1
Reviewed-on: http://review.couchbase.org/18352
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5615 Send CMD_ENABLE_TRAFFIC only after activating vbuckets.

Change-Id: I0c45d4ccba67499367ad9a786f456ead2d81c464
Reviewed-on: http://review.couchbase.org/18332
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
WIP use new doc schema for internal JSON docs

Change-Id: Ie000abbb393092813590fc87a2bb93ba18d977d7
WIP Update UI for new document and metadata separation.

Now the user edits only the document body, the metadata is
elsewhere, so there are no longer "special fields" like _id
and _rev in the document body.

Document REST PUT expects just the JSON body as the HTTP body, so
all meta information (id, rev, etc) must be in path, query and
headers. However, GET, and _bulk_docs POST use the

    {"meta":{"id":"foo"},"body":{...}}

format.

This change also includes a new boilerplate map function
illustrating best practices. It is expected that the docs team
will review and potentially update this soon.

Depends on this change to CouchDB: http://review.couchbase.org/#change,17590

Change-Id: I941672f330e8109fc5390b43ca36e2ca4a1f17b9