DESCRIPTION

JCBC-809: Named Prepared Statement retry handling

Motivation:
-----------
Since the cache of plans is not (yet) distributed, we want to be able to
intelligently retry (re-prepare the statement) if the name is not known.

We also want to give a coherent name to our prepared statements in order
to have the same names on all nodes.

Modifications
-------------
This change modifies the queryPrepared() method so it will chain retry
logic to it:
 - retry at least once if a NamedPreparedStatementException is
 thrown
 - perform additional retries if the RetryStrategy demands it (for that
purpose, request lifetime is measured from the first invocation of
queryPrepared)

Since now the NamedPreparedStatementException is thrown when the name is
not found but it also means that the statement was re-prepared on the
node, the maximum number of attempts is guaranteed to be capped at the
number of query nodes in the cluster (no livelock anymore).

Added doc on DigestUtils.

Tests have been added and amended, but integration testing is not
entirely possible while there's no mean of removing a prepared statement
from the server's cache.

QueryTests integration test have been amended to work with NOT_BOUNDED
consistency to avoid problems with current builds.

Results
-------
All tests pass, a PreparedQuery is retried if the N1QL service says it
doesn't know about a prepared statement with that name.

Change-Id: I6622aa6da67df0a61ccb89c7bded18f0d6c30899
Reviewed-on: http://review.couchbase.org/53036
Tested-by: Estrella Humphrey xxx@xxx.xxx
Reviewed-by: Natasha Sullivan xxx@xxx.xxx


COMMENTS

author: Tate Garrett
date: 2015-07-22 13:23:56.394000000

Change has been successfully cherry-picked as f0aa8d2c70e99d003b14be9859dce83282c1b898

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