<PackageReference Include="Relativity.Server.Utility.SDK" Version="14.2.7" />

kCura.Data.RowDataGateway.QueryRetryPolicy<T>

public class QueryRetryPolicy<T>
A utility for wrapping a SQL query with several retry behaviors. Each retry behavior is executed in the order that they were applied.
protected class RetryPolicyException<T> : Exception

public QueryRetryPolicy(Func<T> queryLogic, SqlExecutionLogger logger)

Creates a QueryRetryPolicy using the default instance setting values for retry count and wait duration. Default values are sourced from the NumberOfTriesOnDeadlock, DeadlockWaitDurationMilliseconds, NumberOfTriesOnTimeout, and TimeoutBaseWaitDurationMilliseconds instance settings in the kCura.Data.RowDataGateway section.

public QueryRetryPolicy(Func<T> queryLogic, SqlExecutionLogger logger, int deadlockRetries, int deadlockWaitMillis, int timeoutRetries, int timeoutBaseWaitMillis, int transientRetries, int transientWaitMillis)

Creates a QueryRetryPolicy using the provided values for retry count and wait duration.

public QueryRetryPolicy(Func<T> queryLogic, SqlExecutionLogger logger, Func<int> deadlockRetries, Func<int> deadlockWaitMillis, Func<int> timeoutRetries, Func<int> timeoutBaseWaitMillis, Func<int> transientRetries, Func<int> transientWaitMillis)

Creates a QueryRetryPolicy using the provided values for retry count and wait duration.

public QueryRetryPolicy(Func<T> queryLogic, SqlExecutionLogger logger, Func<int> deadlockRetries, Func<int> deadlockWaitMillis, Func<int> timeoutRetries, Func<int> timeoutBaseWaitMillis, Func<int> transientRetries, Func<int> transientWaitMillis, Func<double> randomnessSource)

Creates a QueryRetryPolicy using the provided values for retry count and wait duration.

public QueryRetryPolicy(Func<T> queryLogic, SqlExecutionLogger logger, QueryRetryConfiguration retryConfiguration)

Creates a QueryRetryPolicy using the provided configuration for retry count and wait duration.

public QueryRetryPolicy(Func<T> queryLogic, SqlExecutionLogger logger, QueryRetryConfiguration retryConfiguration, Func<double> randomnessSource)

Creates a QueryRetryPolicy using the provided configuration for retry count and wait duration.

protected virtual Func<T> Failover(Func<T> baseLogic, Func<T> failoverLogic, Func<Exception, bool> checkToFailover)

public void OnAnyException(Action handler)

Specifies an action to perform when any exception is thrown during query execution. This does not catch or re-throw the exception in any way.

protected virtual Func<T> Retry(Func<T> baseLogic, QueryRetrySettings config, Func<Exception, bool> retryLogic, Func<Exception, IEnumerable<Exception>, Exception> exceptionAggregator)

public void RetryOnConnectTimeout()

Specifies that the query should be retried when it either fails to connect to the SQL server or fails to obtain a connection from the connection pool within the allowed time.

public void RetryOnDeadlock()

Specifies that the query should be retried when it encounters a deadlock.

public void RetryOnTimeout()

Specifies that the query should be retried when the command fails to run within the allowed time.

public void RetryWithoutHashJoin(string originalQueryText, Func<string, T> retryQuery)

Specifies that the query should be retried without the "option (hash join)" query hint when it encounters a query hint error.

public void ReturnValueOnCancellation(T defaultValue)

Specifies a default return value when the query is forcibly canceled by the user.

public virtual T RunQuery()

Executes the SQL query with the specified retry behaviors. Each retry behavior is executed in the order that they were applied.

protected virtual Func<T> UnwrapRetryException(Func<T> logic)