Members

Object

RetryPolicy.retryDecision

Determines the retry decision for the retry policies.

Static
This member is static
Properties:
Name Type Description
rethrow Number
retry Number
ignore Number

Constructor

new

RetryPolicy

()

Base and default RetryPolicy. Determines what to do when the drivers runs into an specific Cassandra exception

Methods

onReadTimeout

(OperationInfo info, Number consistency, Number received, Number blockFor, Boolean isDataPresent)

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 false, it means the replica that was asked for data has not responded.

Returns:
Type Description
DecisionInfo

onRequestError

(OperationInfo info, Number or undefined consistency, Error err)

Defines whether to retry and at which consistency level on an unexpected error.

This method might be invoked in the following situations:

  1. On a client timeout, while waiting for the server response (see socketOptions.readTimeout), being the error an instance of OperationTimedOutError.
  2. On a connection error (socket closed, etc.).
  3. 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 or undefined

The consistency level of the query that triggered the exception.

err Error

The error that caused this request to fail.

Returns:
Type Description
DecisionInfo

onUnavailable

(OperationInfo info, Number consistency, Number required, Number alive)

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)

Returns:
Type Description
DecisionInfo

onWriteTimeout

(OperationInfo info, Number consistency, Number received, Number blockFor, String writeType)

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 string that describes the type of the write that timed out (“SIMPLE” / “BATCH” / “BATCH_LOG” / “UNLOGGED_BATCH” / “COUNTER”).

Returns:
Type Description
DecisionInfo

rethrowResult

()

Returns a DecisionInfo to callback in error when a err is obtained for a given request.

Returns:
Type Description
DecisionInfo

retryResult

([Number or undefined consistency], [Boolean useCurrentHost])

Returns a DecisionInfo to retry the request with the given consistency.

Parameters:
Name Type Description
consistency optional Number or undefined

When specified, it retries the request with the given consistency.

useCurrentHost optional Boolean

When specified, determines if the retry should be made using the same coordinator. Default: true.

Returns:
Type Description
DecisionInfo