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 webpage details the `TransientFaultDetector` class, which is crucial for handling temporary errors when interacting with Spanner databases in .NET applications."],["The `IsTransientSpannerFault` method is used to detect transient errors in Spanner, indicating whether an operation might succeed upon retry due to temporary issues like network interruptions or service unavailability."],["The content provides links to documentation for multiple versions of the `Google.Cloud.Spanner.Data` library, including the latest beta release (5.0.0-beta05) and a variety of stable releases, up to version 3.5.0."],["The `TransientFaultDetector` class extends the base .NET `Object` class, inheriting its basic methods such as `GetHashCode`, `GetType`, `MemberwiseClone`, and `ToString`."],["Implementing the `ITransientErrorDetectionStrategy` interface, one can define a strategy using `IsTransientSpannerFault` to manage transient faults."]]],[]]