new RetryPolicy()
Base and default RetryPolicy. Determines what to do when the drivers runs into an specific Cassandra exception
- Source:
Members
(static) retryDecision :Object
Determines the retry decision for the retry policies.
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
rethrow |
Number | |
retry |
Number | |
ignore |
Number |
- Source:
Methods
onReadTimeout(info, consistency, received, blockFor, isDataPresent) → {DecisionInfo}
Determines what to do when the driver gets a ReadTimeoutException response from a Cassandra node.
Parameters:
Name | Type | Description |
---|---|---|
info |
OperationInfo | |
consistency |
Number | The consistency level of the query that triggered the exception. |
received |
Number | The number of nodes having answered the request. |
blockFor |
Number | The number of replicas whose response is required to achieve the required consistency. |
isDataPresent |
Boolean | When |
- Source:
Returns:
- Type
- DecisionInfo
onRequestError(info, consistency, err) → {DecisionInfo}
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 socketOptions.readTimeout), being the error an instance of OperationTimedOutError.
- On a connection error (socket closed, etc.).
- When the contacted host replies with an error, such as
overloaded
,isBootstrapping
,serverError
, etc. In this case, the error is instance of ResponseError.
Note that when this method is invoked, the driver cannot guarantee that the mutation has been effectively applied server-side; a retry should only be attempted if the request is known to be idempotent.
Parameters:
Name | Type | Description |
---|---|---|
info |
OperationInfo | |
consistency |
Number | undefined | The consistency level of the query that triggered the exception. |
err |
Error | The error that caused this request to fail. |
- Source:
Returns:
- Type
- DecisionInfo
onUnavailable(info, consistency, required, alive) → {DecisionInfo}
Determines what to do when the driver gets an UnavailableException response from a Cassandra node.
Parameters:
Name | Type | Description |
---|---|---|
info |
OperationInfo | |
consistency |
Number | The consistency level of the query that triggered the exception. |
required |
Number | The number of replicas whose response is required to achieve the required consistency. |
alive |
Number | The number of replicas that were known to be alive when the request had been processed (since an unavailable exception has been triggered, there will be alive < required) |
- Source:
Returns:
- Type
- DecisionInfo
onWriteTimeout(info, consistency, received, blockFor, writeType) → {DecisionInfo}
Determines what to do when the driver gets a WriteTimeoutException response from a Cassandra node.
Parameters:
Name | Type | Description |
---|---|---|
info |
OperationInfo | |
consistency |
Number | The consistency level of the query that triggered the exception. |
received |
Number | The number of nodes having acknowledged the request. |
blockFor |
Number | The number of replicas whose acknowledgement is required to achieve the required consistency. |
writeType |
String | A |
- Source:
Returns:
- Type
- DecisionInfo
rethrowResult() → {DecisionInfo}
Returns a DecisionInfo to callback in error when a err is obtained for a given request.
- Source:
Returns:
- Type
- DecisionInfo
retryResult(consistencyopt, useCurrentHostopt) → {DecisionInfo}
Returns a DecisionInfo to retry the request with the given consistency.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
consistency |
Number | undefined |
<optional> |
When specified, it retries the request with the given consistency. |
useCurrentHost |
Boolean |
<optional> |
When specified, determines if the retry should be made using the same coordinator. Default: true. |
- Source:
Returns:
- Type
- DecisionInfo