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
 - additionally retry up to 100 times if the RetryStrategy is best
effort

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).

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.

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

Change-Id: I6622aa6da67df0a61ccb89c7bded18f0d6c30899


COMMENTS

author: Estrella Humphrey
date: 2015-07-22 09:49:37.331000000

Uploaded patch set 2.

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

Change has been successfully cherry-picked as f0aa8d2c70e99d003b14be9859dce83282c1b898

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