Merge remote-tracking branch 'couchbase/master' into b202

* couchbase/master: (25 commits)
  MB-7415: fast doc lookups using doc ptr instead of id
  MB-7432: add replicate rate in outbound XDCR stats
  CBD-771: dump compressed stats files
  MB-7671 Check fragmentation before compacting vbucket.
  MB-5307 Log less when deciding if compaction is needed.
  MB-5307 Don't log useless message about changed config.
  MB-5307 Fix typo in ns_node_disco.
  MB-5307 run_on_subset doesn't crash when there are no stats.
  CBD-771: Stats archiver uses ETS to replace Mnesia
  MB-7432 Monitor only the last N checkpoint status
  MB-7432: XDCR stats enhancement
  MB-7574 Unsupport /polls/default/stats REST call.
  MB-5307 Explicitly close file when handling memcached logs.
  MB-7275: fix XDCR aggregated stats issue
  MB-5307 Don't require argument for -i flag.
  MB-100: Made error message on bucket deletion more clear.
  MB-7468: support both V0 and V1 formats of portsigar replies
  MB-7468 Stats for number of faults experienced by the server.
  MB-7381: allow flush with bucket credentials
  MB-7282: wait autofailover service startup prior to calling it
  ...

Change-Id: Ib76b3f3ca3856e355bf93e8b6e0daeaa4e926962
MB-7701: latency optimized XDCR

In this commit, we optimistically send all docs to remote cluster
without sending a rev_diff beforehand. This optimization is meant
to improve the replication latency at the cost of potentially more
bandwidth usage in some use cases.

The feature is controlled by a new boolean ns_config parameter:

xdcr_optimistic_replication

Like other xdcr parameters, users are able to override the ns_config
parameter by a boolean environment parameter:

XDCR_OPTIMISTIC_REPLICATION

When a replication is created, this parameter will be read and stored
in the bucket replicator along with other replication options, and
applied to all vb replicators under that bucket replicator. Therefore
users need to stop/restart the replication to make it effective. It
does not make sense to apply this parameter to only a subse of vb
replicators during an ongoing XDCR.

Regarding exposing the feature to UI, today I am not sure how current
UI implementes parameters that need to be passed down to different
components. That is one of the reasons why the ns_server parameters
is introduced. Another reason is we should allow users to choose this
mode by REST API.

In this commit, IMHO it should be OK to leave these parameters here
so QE is able to write some code to test it. When the UI team exposes
this option to Couchbase admin console,  we can figure out a better
way to control this feature. It would be nice that UI code can modify
the value of an ns_server parameter based on input from user.

Change-Id: Iee6428583728f0645fc3282163d892a6a6670e07
Reviewed-on: http://review.couchbase.org/24524
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Junyi Xie <junyi.couchbase@gmail.com>
Tested-by: Junyi Xie <junyi.couchbase@gmail.com>
Merge remote-tracking branch 'couchbase/2.0.2'

* couchbase/2.0.2:
  MB-7701: latency optimized XDCR

Change-Id: Ic6f45c909b12b3aa17167806b53b9b7fab103efb