Reference documentation and code samples for the Google.Cloud.Spanner.Data class TransientFaultDetector.
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"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis documentation provides reference information for the \u003ccode\u003eTransientFaultDetector\u003c/code\u003e class within the \u003ccode\u003eGoogle.Cloud.Spanner.Data\u003c/code\u003e namespace, detailing its role in managing transient errors during Spanner transactions.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version documented is \u003ccode\u003e5.0.0-beta05\u003c/code\u003e, with various previous versions listed, starting from 3.5.0, each with its corresponding documentation.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eTransientFaultDetector\u003c/code\u003e class is designed to assist in detecting if a Spanner operation failure is transient, meaning it could potentially succeed if retried, particularly due to temporary network or service issues.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eIsTransientSpannerFault\u003c/code\u003e method is a key feature, determining if a given exception represents a transient Spanner error that could be resolved by retrying the operation.\u003c/p\u003e\n"],["\u003cp\u003eTo implement a retry strategy, one must create a class that implements \u003ccode\u003eITransientErrorDetectionStrategy\u003c/code\u003e, and use the method \u003ccode\u003eIsTransientSpannerFault()\u003c/code\u003e to determine if a retry should occur.\u003c/p\u003e\n"]]],[],null,[]]