Class NoSQLRetryHandler
Represents the built-in retry handler.
Implements
Namespace: Oracle.NoSQL.SDK
Assembly: Oracle.NoSQL.SDK.dll
Syntax
public class NoSQLRetryHandler : Object, IRetryHandler
Remarks
This is the default retry handler used by the driver, but it can
also be customized via the provided properties. The general semantics
is as follows:
- The operations are retried up to the maximum number of times indicated by MaxRetryAttempts property (with the default value of 10).
- The retry delay follows the exponential back-off. The initial base delay is given by BaseDelay property (with the default value of 1 second). The total delay is computed as a sum of the base delay component which starts with BaseDelay and increases two-fold on each retry and a small random delay between 0 and initial BaseDelay.
- Operations that fail with ControlOperationThrottlingException use much longer base delay given by ControlOperationBaseDelay property. These are usually table DDL operations that have much more stringent rate limitations in the cloud and thus should be retried much less often. The delay algorithm is still exponential back-off but uses the base delay of ControlOperationBaseDelay (with the default value of 1 minute).
- Network-related exceptions and SecurityInfoNotReadyException are always retried (up to the operation timeout) regardless of the number of retries done so far (thus ignoring MaxRetryAttempts).
- For SecurityInfoNotReadyException the delay algorithm starts with constant delays of 1 second up to 10 retries and after that follows the exponential back-off.
- InvalidAuthorizationException will be retried as long as the exception on the previous retry (if any) was not InvalidAuthorizationException. InvalidAuthorizationException may indicate that the authentication token is expired in which case the operation should be retried, which will involve the refresh of the authentication token. On the other hand, if subsequent retries fail with InvalidAuthorizationException, this most likely indicates invalid credentials in which case the operation should not be retried again.
Examples
Instantiating NoSQLRetryHandler with the customized parameters.var config = new NoSQLConfig();
...
config.RetryHandler = new NoSQLRetryHandler
{
MaxRetryAttempts = 20,
BaseDelay = TimeSpan.FromSeconds(2),
ControlOperationBaseDelay = TimeSpan.FromSeconds(30),
SecurityInfoConstantDelayRetries = 50
};
Constructors
Name | Description |
---|---|
NoSQLRetryHandler() |
Properties
Name | Description |
---|---|
BaseDelay | Gets or sets the base retry delay. |
ControlOperationBaseDelay | Gets or sets the base retry delay when an operation fails with ControlOperationThrottlingException. |
MaxRetryAttempts | Gets or sets the maximum number of retries. |
Methods
Name | Description |
---|---|
GetRetryDelay(Request) | Determines how long to wait between successive retries. |
ShouldRetry(Request) | Determines whether the operation should be retried. |