Class: IdempotenceAwareRetryPolicy

policies/retry~IdempotenceAwareRetryPolicy(childPolicyopt)

A retry policy that avoids retrying non-idempotent statements.

In case of write timeouts or unexpected errors, this policy will always return rethrowResult() if the statement is deemed non-idempotent (see QueryOptions.isIdempotent).

For all other cases, this policy delegates the decision to the child policy.

Constructor

new IdempotenceAwareRetryPolicy(childPolicyopt)

Creates a new instance of IdempotenceAwareRetryPolicy.

Parameters:
Name Type Attributes Description
childPolicy RetryPolicy <optional>

The child retry policy to wrap. When not defined, it will use an instance of RetryPolicy as child policy.

Deprecated:
  • Since version 4.0 non-idempotent operations are never tried for write timeout or request error, use the default retry policy instead.
Source:

Extends

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

Overrides:
Source:
Returns:
Type
DecisionInfo

onRequestError()

If the query is not idempotent, it returns a rethrow decision. Otherwise, it relies on the child policy to decide.

Overrides:
Source:

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)

Overrides:
Source:
Returns:
Type
DecisionInfo

onWriteTimeout()

If the query is not idempotent, it return a rethrow decision. Otherwise, it relies on the child policy to decide.

Overrides:
Source:

rethrowResult() → {DecisionInfo}

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

Inherited From:
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.

Inherited From:
Source:
Returns:
Type
DecisionInfo