Transactions can be retried using the Transient Fault Handling Application Block.
This extension helps you create a strategy that will detect transient faults when performing
transactions with Spanner.
To create an execution strategy, create a class
class SpannerTransientErrorDetectionStrategy : ITransientErrorDetectionStrategy
{
public bool IsTransient(Exception ex) => ex.IsTransientSpannerFault();
}
public static bool IsTransientSpannerFault(this Exception exception)
Returns true if the exception represents a transient error in Spanner.
This indicates that the operation may succeed if it is attempted again.
Common errors that can cause this include temporary network interruption
or the service being temporarily unavailable.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-21 UTC."],[[["This page details the `TransientFaultDetector` class, which is utilized for detecting transient faults in Spanner transactions, allowing for retry strategies to be implemented."],["The `IsTransientSpannerFault` method, which takes an exception as a parameter, is used to determine if an exception signifies a transient error that could be resolved with a retry."],["The latest available version is `5.0.0-beta05`, but other versions of the library, ranging from `3.5.0` to `4.6.0`, are also documented and available for reference."],["The `TransientFaultDetector` class inherits from the base `Object` class and includes methods like `GetHashCode()`, `GetType()`, `MemberwiseClone()`, and `ToString()`, along with its specific method, `IsTransientSpannerFault(Exception)`."]]],[]]