Class IdempotenceAwareRetryPolicy
A retry policy that avoids retrying non-idempotent statements.
In case of write timeouts this policy will always return Rethrow() if the statement is considered non-idempotent (see IsIdempotent). For all other cases, this policy delegates the decision to the child policy.
Inheritance
Inherited Members
Namespace: Cassandra
Assembly: Cassandra.dll
Syntax
public class IdempotenceAwareRetryPolicy : IExtendedRetryPolicy, IRetryPolicy
Constructors
IdempotenceAwareRetryPolicy(IRetryPolicy)
Creates a new instance of IdempotenceAwareRetryPolicy.
Declaration
public IdempotenceAwareRetryPolicy(IRetryPolicy childPolicy)
Parameters
Type | Name | Description |
---|---|---|
IRetryPolicy | childPolicy | The retry policy to wrap. |
Properties
ChildPolicy
Declaration
public IRetryPolicy ChildPolicy { get; }
Property Value
Type | Description |
---|---|
IRetryPolicy |
Methods
OnReadTimeout(IStatement, ConsistencyLevel, Int32, Int32, Boolean, Int32)
Defines whether to retry and at which consistency level on a read timeout.
Note that this method may be called even if requiredResponses >=
receivedResponses
if dataPresent
is false
(see com.datastax.driver.core.exceptions.ReadTimeoutException#WasDataRetrieved).
Declaration
public RetryDecision OnReadTimeout(IStatement stmt, ConsistencyLevel cl, int requiredResponses, int receivedResponses, bool dataRetrieved, int nbRetry)
Parameters
Type | Name | Description |
---|---|---|
IStatement | stmt | |
ConsistencyLevel | cl | the original consistency level of the read that timeouted. |
System.Int32 | requiredResponses | the number of responses that were required to achieve the requested consistency level. |
System.Int32 | receivedResponses | the number of responses that had been received by the time the timeout exception was raised. |
System.Boolean | dataRetrieved | whether actual data (by opposition to data checksum) was present in the received responses. |
System.Int32 | nbRetry | the number of retry already performed for this operation. |
Returns
Type | Description |
---|---|
RetryDecision | the retry decision. If |
OnRequestError(IStatement, Configuration, Exception, Int32)
Defines whether to retry and at which consistency level on an unexpected error.
This method might be invoked in the following situations:
- On a client timeout, while waiting for the server response (see ReadTimeoutMillis).
- On a socket error (socket closed, etc.).
- When the contacted host replies with an
OVERLOADED
error or aSERVER_ERROR
.
Note that when such an error occurs, there is no guarantee that the mutation has been applied server-side or not.
Declaration
public RetryDecision OnRequestError(IStatement stmt, Configuration config, Exception ex, int nbRetry)
Parameters
Type | Name | Description |
---|---|---|
IStatement | stmt | |
Configuration | config | The current cluster configuration. |
System.Exception | ex | The exception that caused this request to fail. |
System.Int32 | nbRetry | The number of retries already performed for this operation. |
Returns
Type | Description |
---|---|
RetryDecision |
OnUnavailable(IStatement, ConsistencyLevel, Int32, Int32, Int32)
Defines whether to retry and at which consistency level on an unavailable exception.
Declaration
public RetryDecision OnUnavailable(IStatement stmt, ConsistencyLevel cl, int requiredReplica, int aliveReplica, int nbRetry)
Parameters
Type | Name | Description |
---|---|---|
IStatement | stmt | |
ConsistencyLevel | cl | the original consistency level for the operation. |
System.Int32 | requiredReplica | the number of replica that should have been (known) alive for the operation to be attempted. |
System.Int32 | aliveReplica | the number of replica that were know to be alive by the coordinator of the operation. |
System.Int32 | nbRetry | the number of retry already performed for this operation. |
Returns
Type | Description |
---|---|
RetryDecision | the retry decision. If |
OnWriteTimeout(IStatement, ConsistencyLevel, String, Int32, Int32, Int32)
Defines whether to retry and at which consistency level on a write timeout.
Declaration
public RetryDecision OnWriteTimeout(IStatement stmt, ConsistencyLevel cl, string writeType, int requiredAcks, int receivedAcks, int nbRetry)
Parameters
Type | Name | Description |
---|---|---|
IStatement | stmt | |
ConsistencyLevel | cl | the original consistency level of the write that timeouted. |
System.String | writeType | the type of the write that timeouted. |
System.Int32 | requiredAcks | the number of acknowledgments that were required to achieve the requested consistency level. |
System.Int32 | receivedAcks | the number of acknowledgments that had been received by the time the timeout exception was raised. |
System.Int32 | nbRetry | the number of retry already performed for this operation. |
Returns
Type | Description |
---|---|
RetryDecision | the retry decision. If |