DESCRIPTION

JVMCBC-205: Support HELLO command and feature negotiation.

Motivation
----------
To negotiate supported features between the client and the server,
a new HELLO command has been introduced. The client asks what features
are available (that it supports) and the server will respond with the
ones it has enabled.

The common baseline can then be utilized at runtime. This allows the
client to conditionally use new features like optimized observe,
optimized RYW N1QL queries or forcing TCP_NODELAY on the server
side.

In addition to that, it allows for future negotiations like compression,
datatypes and many more.

Finally, on every HELLO command the client identifies itself with its
user agent, allowing for better logging and tracing on the server side
(which clients are active,...).

Modifications
-------------
In this changeset, the negotiation process is hooked up into the KV
pipeline and always asks for:

- TCP_NODELAY (disable nagle)
- MUTATION_SEQNO (returning seqnos on mutations)

If the server supports them, they will be enabled.

Both options will be made configurable in later changesets to not
bloat this one too much. See JVMCBC-206 and JVMCBC-207 for the
follow-up tickets.

Result
------
Intelligent handshaking between client and server features.

Change-Id: I5dd15c8cb5767fcb7b3152216ad215cda0c1ddd8


COMMENTS

author: Natasha Sullivan
date: 2015-06-12 09:51:18.829000000

Uploaded patch set 3: Commit message was updated.

-------------------------------------
author: Natasha Sullivan
date: 2015-06-12 09:54:36.269000000

Patch Set 3: Verified+1

-------------------------------------
author: Wyatt Kramer
date: 2015-06-12 17:22:29.938000000

Patch Set 3:

(6 comments)

Looks good. I'm not sure if any of the hello codes, other than MUTATION_SEQNO are actually exposed. memcached.h is not a good indicator of what is and isn't public API

Line:46, src/main/java/com/couchbase/client/core/message/kv/MutationDescriptor.java -> In LCB I also included the vBucket itself (despite technically being redundant). This allows it to be used in things like N1QL etc

Line:37, src/main/java/com/couchbase/client/core/endpoint/ServerFeatures.java -> Not exposed, but present since 3.0

Line:48, src/main/java/com/couchbase/client/core/endpoint/ServerFeatures.java -> Not exposed, AFAIK

Line:62, src/main/java/com/couchbase/client/core/endpoint/ServerFeatures.java -> Not exposed AFAIK

Line:67, src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueFeatureHandler.java -> Is this exposed?

Line:112, src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueFeatureHandler.java -> Not sure what this expands to, but should be a client identifier of some sort.

-------------------------------------
author: Estrella Humphrey
date: 2015-06-15 08:42:52.757000000

Patch Set 3: Code-Review+2

(I see that Mark's comments were addressed in http://review.couchbase.org/51999)

-------------------------------------
author: Gerrit Code Review
date: 2015-06-15 17:05:54.499000000

Change has been successfully cherry-picked as 536c944e556b7c25c9fab1da10a4f465b667701b

-------------------------------------
