Class PostgresStalePositionDetector
Detects and classifies stale CDC position errors from Postgres exceptions.
public static class PostgresStalePositionDetector
- Inheritance
-
PostgresStalePositionDetector
- Inherited Members
Fields
ConnectionFailure
Postgres SQLSTATE for connection failure.
public const string ConnectionFailure = "08006"
Field Value
FeatureNotSupported
Postgres SQLSTATE for feature not supported (e.g., wal_level not logical).
public const string FeatureNotSupported = "0A000"
Field Value
ObjectNotInPrerequisiteState
Postgres SQLSTATE for object not in prerequisite state (replication slot invalid).
public const string ObjectNotInPrerequisiteState = "55000"
Field Value
ProtocolViolation
Postgres SQLSTATE for protocol violation (logical decoding issues).
public const string ProtocolViolation = "08P01"
Field Value
UndefinedObject
Postgres SQLSTATE for undefined object (publication/slot not found).
public const string UndefinedObject = "42704"
Field Value
WalSegmentNotAccessible
Postgres SQLSTATE for WAL segment not accessible (could_not_access_file).
public const string WalSegmentNotAccessible = "58P01"
Field Value
Properties
StalePositionSqlStates
Gets the set of Postgres SQLSTATE codes that indicate a stale CDC position.
public static IReadOnlySet<string> StalePositionSqlStates { get; }
Property Value
Methods
CreateEventArgs(Exception, string, PostgresCdcPosition?, PostgresCdcPosition?, string?, string?, string?)
Creates a CdcPositionResetEventArgs from an exception and context.
public static CdcPositionResetEventArgs CreateEventArgs(Exception exception, string processorId, PostgresCdcPosition? stalePosition = null, PostgresCdcPosition? newPosition = null, string? replicationSlot = null, string? publication = null, string? databaseName = null)
Parameters
exceptionExceptionprocessorIdstringstalePositionPostgresCdcPosition?newPositionPostgresCdcPosition?replicationSlotstringpublicationstringdatabaseNamestring
Returns
GetReasonCode(PostgresException?)
Determines the appropriate reason code from a Postgres exception.
public static string GetReasonCode(PostgresException? exception)
Parameters
exceptionPostgresException
Returns
GetStalePositionSqlState(Exception?)
Extracts the SQLSTATE code that indicates a stale position from the exception.
public static string? GetStalePositionSqlState(Exception? exception)
Parameters
exceptionException
Returns
IsStalePositionException(Exception?)
Determines whether the specified exception indicates a stale CDC position.
public static bool IsStalePositionException(Exception? exception)
Parameters
exceptionException
Returns
IsStalePositionSqlState(string?)
Determines if a SQLSTATE code indicates a stale position scenario.
public static bool IsStalePositionSqlState(string? sqlState)
Parameters
sqlStatestring