MB-10059 Don't create a new rev_seq for a new item on replica.

Replica vbucket currently ignores rev_seq values of new items
from its active vbucket, but instead generates new rev_seq
values for those new items. This can cause the XDCR to be in
inconsistent state, especially when the rebalance or failover
happens. This change makes sure that the replica vbucket uses
a rev_seq value from its active vbucket for a new item.

Change-Id: I634d0296a610b88ffb5e1b97d20606a01d41dc23
Reviewed-on: http://review.couchbase.org/33501
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
MB-10059 Remove the unnecessary check in getting a rev_seq value

Change-Id: I1757b5b0f8c2d58474faeabeb046e9363df3f346
Reviewed-on: http://review.couchbase.org/33502
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
MB-10059 Set a backfilled QueuedItem's rev_seq from hashtable.

Change-Id: Idfd3eb5a69147c657705232b2c0b6cf0a38ab902
Reviewed-on: http://review.couchbase.org/33503
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
MB-10277 Fix to the memory corruption bug in TOUCH command

If TOUCH command is issued with the same expiration time for
a non-resident item, it causes the segmentation fault due to
the NULL pointer to an Item instance.
This change makes sure that we create an Item instance in the
above case because we still need to send the item's metadata
to the client.

Change-Id: Ic1efe24add1f0a3d2da2804c106b61c26bb275fc
Reviewed-on: http://review.couchbase.org/33848
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
Merge remote-tracking branch 'couchbase/2.5.0'

Conflicts:
	src/backfill.cc
	src/ep.cc
	src/stored-value.h

Change-Id: Id2dc7912602875b77453ca055ca05831db2128eb
Fix to the compilation issue in ep_testsuite

Change-Id: I6071fcf7af55a2a0ff91c86e084c114e42ea20d5
Reviewed-on: http://review.couchbase.org/33850
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
Fix out of the source builds

Change-Id: I6e03ac4f5d420026fc20797424c8672687b39171
Reviewed-on: http://review.couchbase.org/33935
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
MB-9869: Ensure datatype set is not spurious

- If datatype exceeds allowed values:
PROTOCOL_BINARY_RAW_BYTES=0x00
PROTOCOL_BINARY_DATATYPE_JSON=0x01
PROTOCOL_BINARY_DATATYPE_COMPRESSED=0x02
PROTOCOL_BINARY_DATATYPE_COMPRESSED_JSON=0x03

, return ENGINE_EINVAL, to notify client about
invalid argument.

Change-Id: I1af09034e520a1e6c7fae7afa99bee124ea21540
Reviewed-on: http://review.couchbase.org/33648
Reviewed-by: abhinav dangeti <abhinav@couchbase.com>
Tested-by: abhinav dangeti <abhinav@couchbase.com>
Consider datatype while creating item instance

- UprConsumer::mutation

Change-Id: Iec6e4c2f95728e740781cacaf13a5a14732cb564
Reviewed-on: http://review.couchbase.org/33895
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: abhinav dangeti <abhinav@couchbase.com>
Free all streams when an upr consumer is deleted

Change-Id: Ib41574d15e57528b13c90796703a6065ebd2a90e
Reviewed-on: http://review.couchbase.org/32404
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-9694: Fix crash caused by creating two same named upr conns

When we have an upr connection with a given name and another upr
connection is made with the same name then we need to close the
first connection and allow the second one to be created.

Change-Id: I0346b70f395b3d8c29f5288ffc7ecd5cc36a7700
Reviewed-on: http://review.couchbase.org/33309
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Add test-valgrind to run the testsuite under valgrind

Change-Id: I5c173d8d264cf3ac15621a5574f0b9eac7bfcd44
Reviewed-on: http://review.couchbase.org/33978
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Move gencode and genconfig back from memcached

Change-Id: Ia711001103a91d50b6601915f6498258e8c1d186
Reviewed-on: http://review.couchbase.org/33980
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Remove autoconf-specific files from .gitignore

Change-Id: I4495967653e99ff50c7b75f2290d6bb44397fc08
Reviewed-on: http://review.couchbase.org/33981
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Fix win32 build

Change-Id: I8e2081b2ff6b43ea2235f9a8dd4a2879783d7bdd
Reviewed-on: http://review.couchbase.org/33984
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Disable engine tests for win32 until they're fixed

Change-Id: Iaaec8442043e74eb8d24e4e84389aea349200281
Reviewed-on: http://review.couchbase.org/33987
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
MB-10264: Added more logging for mccouch connection

More logging for send and receive data from mccouch
in Couch-Notifier

Change-Id: I6a6817f207772132000ec11901d1fc1de91156b9
Reviewed-on: http://review.couchbase.org/33916
Tested-by: David Liao <david.liao@couchbase.com>
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Remove unused win32 directory

Change-Id: I98d140bcaf793a66cd3220a81f689570db869ae5
Reviewed-on: http://review.couchbase.org/34014
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
MB-10282: Remove TapConn class

We don't need this class since it doesn't provide anything more
than its parent class Connection contains.

Change-Id: Ieb101907bc7452b17d7989c10cb1ee72b208282b
Reviewed-on: http://review.couchbase.org/33912
Tested-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
MB-10282: Remove Connection class

The Connection class contained data for a particular connection,
but since the ConnHandler class just contains accessors for the
almost all of the Connection classes data we should just merge
the two classes together.

Change-Id: Ie03174873e2969cb154f229d10086b0058c5e9dc
Reviewed-on: http://review.couchbase.org/33913
Tested-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>