DESCRIPTION

JCBC-708: Exception for most probable lock failures

Motivation
----------
For lock related operations, the server doesn't have an explicit error
code for lock-specific errors (like the key is already locked or the cas
provided to unlock is wrong). It returns TEMPFAIL. Another transient
error code is BUSY, where we are sure this is not related to locks.

Distinguish between these two by introducing a new Exception. Don't hide
the ambiguity by returning a CASMismatchException (when the actual error
could be another transient one).

Modifications
-------------
Added new TemporaryLockFailureException, thrown when receiving TEMPFAIL.

BREAKING: unlock now throws TemporaryLockFailureException when the cas
doesn't match, because the server doesn't let us know for sure, so a
CASMismatchException could hide another problem.

Amended tests and added a test for double locking failure.

Results
-------
Client can be sure a transient error is not related to locks when
receiving a TemporaryFailureException.
On the other hand, lock problems are the most probable cause for the new
exception, TemporaryLockFailureException.
Unit tests and integration test pass.

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


COMMENTS

author: Estrella Humphrey
date: 2015-02-11 15:48:01.693000000

Change has been successfully cherry-picked as a829e392118c4bf9a5b72648afe85a6fdacac781

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