JAVA-764: Retry with the normal consistency level (not the serial one) when a write times out on the Paxos phase.

Description

  • When a write timeout occurs, the Java driver can be configured to call a RetryPolicy to allow clients flexibility in error handling.

  • The onWriteTimeout method is passed a single ConsistencyLevel argument, described as "the original consistency level of the write that timed out." This looks a bit sketchy since writes can set two kinds of consistency levels (CL and SCL), but the retry handler only gets informed about one.

  • When a write timeout occurs on a SCL=SERIAL write, the consistency level passed to onWriteTimeout is SERIAL. Retrying with the level given results in an InvalidQueryException.

The bug is reproduced in this simple java program:

https://github.com/Datomic/CassandraCAS


Resolution:
When a write times out on the Paxos phase, retry with the consistency level of the previous attempt (not the serial CL).
Updated the built-in policies.
Added ConsistencyLevel.isSerial (JAVA-982)
Changed the code so that a retry with CL=null uses the CL of the last attempt, not the original one (in case a downgrading policy retries multiple times).
Clarified javadocs.

Environment

None

Pull Requests

None

Status

Assignee

Alexandre Dutra

Reporter

Sebastian Estevez

Labels

None

PM Priority

None

Reproduced in

None

Affects versions

None

Fix versions

Pull Request

None

Doc Impact

None

Size

None

External issue ID

None

External issue ID

None

Sprint

Priority

Major
Configure