MB-8937: fix internal setting of "xdcrOptimisticReplicationThreshold"

For parameter "xdcrOptimisticReplicationThreshold", the default value
is 256, and it should show up in internal settings.

Change-Id: Ib379a6dbbe1dec890b9ab9b7feff22ca73685c43
Reviewed-on: http://review.couchbase.org/28480
Tested-by: Junyi Xie <junyi.couchbase@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-8905: modify resolution algorithm for deletion in XMEM

The fix of MB-8825 at ep_engine side modified the resolution
algorithm for deletion, that is, we only compare Seqno and CAS
for del mutation in delWithMeta(). Because XDCR provides an
option to do local conflict resolution for backward compati-
bility, we also need to change the XDCR side conflict resolution
algorithm accordingly, to be consistent with ep_engine side
change.  The bottom line is, resolution algorithm should be the
same regardless of the location where we do conflict resolution.

Change-Id: I0a107b743b3b5b4f0ed9889c279ab0ebe1fa9c23
Reviewed-on: http://review.couchbase.org/28405
Reviewed-by: Junyi Xie <junyi.couchbase@gmail.com>
Tested-by: Junyi Xie <junyi.couchbase@gmail.com>
MB-8150 disallow certain ports for cluster and bucket init

- default epmd port (4369)
- ports from erlang kernel port range
- current rest api port (for buckets)
- moxi port
- 2 memcached ports : mccouch_port, dedicated_port, port
- capi port
- any of the existing buckets ports

the fix is made with the assumption that we have one
node per box.

Change-Id: I5d58ad1c45bc732458cd6bea551b0be0190bb3ad
Reviewed-on: http://review.couchbase.org/28462
Reviewed-by: Artem Stemkovski <artem@couchbase.com>
Tested-by: Artem Stemkovski <artem@couchbase.com>
MB-8911: CAPI side resolution algorithm change for deletion

Since 2.2, ep_engine changes the resolution algorithm for deletion.
To be consistent, CAPI mode replication should also adopt the same
algorithm.

Actually ep_engine will do their resolution in deleteWithMeta(),
here we put another defense line (the second getMeta before writing
doc locally) in CAPI just for safety and performance reasons.

Change-Id: I008e41b7dced21ee76e0b1e71bfd0d68b6f972d1
Reviewed-on: http://review.couchbase.org/28446
Tested-by: Junyi Xie <junyi.couchbase@gmail.com>
Reviewed-by: Artem Stemkovski <artem@couchbase.com>
MB-8930: avoid crash replicator when timeout in getMeta

It is hard to expect when remote memcached will return the key
metadta that source XMem requests. Today we crash replicators if
the getMeta() to remote timed out or source receives some unexpected
memcached errors. A better behavior is that we send doc to remote
optimistically if we are unable to fetch the metadata from remote
memcached. The del/setWithMeta at remote cluster will do resolution
for us.

Also, we make separate stat for timeout from other errors.

Change-Id: Idddc07e287a5d56a4410af10c56b81fa39daf800
Reviewed-on: http://review.couchbase.org/28483
Reviewed-by: Artem Stemkovski <artem@couchbase.com>
Tested-by: Artem Stemkovski <artem@couchbase.com>
Merge remote-tracking branch 'couchbase/2.2.0'

* couchbase/2.2.0:
  MB-8930: avoid crash replicator when timeout in getMeta
  MB-8911: CAPI side resolution algorithm change for deletion
  MB-8150 disallow certain ports for cluster and bucket init
  MB-8905: modify resolution algorithm for deletion in XMEM
  MB-8937: fix internal setting of "xdcrOptimisticReplicationThreshold"

Change-Id: Ib3e012503ea29568d6a041cdd6ba5fff82e30890