Added support for unl command

Based on patch submitted by Brent Ryan

Change-Id: I9da7cc17eb5adedc9c2cac79ab562bab0fc7ba52
Reviewed-on: http://review.couchbase.org/12908
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Raghavan N. Srinivas <raghavan.srinivas@gmail.com>
Created TapStream abstraction

Previously when we created a tap stream we would only send it
to a single node in the memcached cluster. This fix creates
a tap stream abstraction that aggregates the tap streams
sent to each server and treats them as a single tap stream.

Change-Id: I68650e187eec5f79952dab1374bad0e07d5a6c30
Reviewed-on: http://review.couchbase.org/13081
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Made TapAck its own class

This will help reduce having duplicate code.

Change-Id: I96f7fb126ab3f7879e590131ded7229f9f75bc31
Reviewed-on: http://review.couchbase.org/13084
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
Enhanced TapTest, ensuring success with random leftovers.

Change-Id: Ia5ed0e3a6a2074a1dac229904826fdd838e06b37
Reviewed-on: http://review.couchbase.org/13362
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
Remove test for "stats cachedump".

In the most recent memcached memcached branch, stats cachedump
has been removed.  It now returns an error saying it's not supported.

See also:
http://code.google.com/p/memcached/issues/detail?id=207
http://www.couchbase.com/issues/browse/MB-4058
http://review.couchbase.org/#change,13854

Change-Id: Ib3d344e7a0db28994017c515e1c56c4efdcfae19
Reviewed-on: http://review.couchbase.org/14142
Tested-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Wait longer on tap data received.

Change-Id: I5279eec0f642688013c9a8d98ca4a7922cae9d42
Reviewed-on: http://review.couchbase.org/13509
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Reviewed-by: Raghavan N. Srinivas <raghavan.srinivas@gmail.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
Fixed handling of TAP flags.

The request and response messages for flags were not following the defined
protocol for their data size.  Also, the logic in the setting of the flags
was incorrect, meaning it wasn't actually possible to determine which
flags were set.

A test that verifies correct behavior will be added in a later commit
that introduces test coverage for the ResponseMessage class.

Change-Id: I20ae1b176cb3bc764e993ab98254b15f69cba9ea
Reviewed-on: http://review.couchbase.org/13995
Reviewed-by: Raghavan N. Srinivas <raghavan.srinivas@gmail.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
Decode TAP mutation flags as host byte order.

In trying to decode the item flags from a tap mutation, it was found
that the flags are stored in the server in network byte order, but
when sent over tap it goes through htonl() conversion, making it a
double conversion.

Future versions of the server now allow for the client to specify
it would like the flags sent correctly, via a TAP flag, and the
server will set a flag to say they're being sent correctly.  With
this change, we now request things to be correct and if we don't
receive a flag saying it's correct, we swap the bytes (assuming we
are talking to a 'broken' server).

In developing this change, a test was also developed but to
complete the test correctly, some other issues had to be fixed.
Thus the test isn't in this commit, but rather in it's own commit
after cleaning up the mess.

Change-Id: I63b69273cac194163b784211474ec2ff77bd7959
Reviewed-on: http://review.couchbase.org/13510
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
Add test coverage for ResponseMessage and fix to get bytes.

This adds test coverage to the ResponseMessage.  This test was used
for finding and addressing a number of recent fixes and verifying
correct support for requesting the flags to be sent correctly in
network byte order.  These other fixes were added in recent commits.

Change-Id: I68355b5ea10437c144a7b4a46adb7d005edfa0fc
Reviewed-on: http://review.couchbase.org/13996
Reviewed-by: Raghavan N. Srinivas <raghavan.srinivas@gmail.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
Complete the removal of stats cachedump.

Unfortunately, late night coding means I put up a change and
marked it verified, but it makes the project not compile.  Not
worth rewriting history for these 5 commits or so, but need
to fix it.

See also http://review.couchbase.org/#change,14142

Change-Id: I975a79774fe7d8ec0484fb69c0910525ed164b02
Reviewed-on: http://review.couchbase.org/14143
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
Bump log4j to 1.2.16 to get rid of transitive JMS deps.

Change-Id: Ie98c136a0c1d450ba3aa5ccd12dfc40650653131
Reviewed-on: http://review.couchbase.org/14158
Tested-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Make log4j, spring-beans optional in our maven artifacts.

Change-Id: I579a5832fc4ff0ed9d4303c80b309a25dc8cfbaf
Reviewed-on: http://review.couchbase.org/14159
Tested-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Added toString() for ResponseMessage.

Change-Id: Ie627cd14631a01a0258d67337251c552e90aa3bc
Reviewed-on: http://review.couchbase.org/13361
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
Retry not my vbucket error for optimized sets. SPY-88

Change-Id: I729781636917f80714cf8d9460e4523e876e1258
Reviewed-on: http://review.couchbase.org/16251
Tested-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Change vbucket retry logging to debug level. SPY-87

Change-Id: I31aa045ff6d328858fa44e53720e38b20b8d38dc
Reviewed-on: http://review.couchbase.org/16257
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Make queueReconnect protected so subclasses can request reconnects.

In fixing JCBC-53 on the Couchbase Java client, a need to queue
reconnections in some cluster configuration updates was found to be
required.  This change allows that.

Change-Id: I25ce3945b4e5e6527dd680031237be22faed69ee
Reviewed-on: http://review.couchbase.org/16335
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Fixed tap message test cases

The flags were wrong here. We were passing a long, but the flag said
it was an int.

Change-Id: I58af8a9899025fc54db4d374bce6ca5d29b309af
Reviewed-on: http://review.couchbase.org/15947
Tested-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Create an ErrorCode class for error codes

This allows us to use error codes in other places than just
operations. This class defines all of the Memcached error codes
as well as two client specific codes (timed out and canceled). The
reason for client specific error codes is that is gives the user
something definitive to test against when error cases happen.

Change-Id: I6b4b21ec8448444103d8e73b440df6085bdc1e33
Reviewed-on: http://review.couchbase.org/15948
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
OperationStatus now has an error code

Having error codes will make it easier for users who get errors
to test for what error it is. Right now we only have the message
string and this can actually be different for the same error type.

Change-Id: I067e3145d5d95b09d7ca0ad0445bcfa5d5784d51
Reviewed-on: http://review.couchbase.org/15949
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Make the OperationState volatile.  SPY-88

Change-Id: Id8a871c018a6a6372367129b8924e5a833f83644
Reviewed-on: http://review.couchbase.org/16255
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>