Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions flow/alerting/classifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ var (
PostgresSpillFileMissingRe = regexp.MustCompile(`Unable to restore changes for xid \d+`)
// e.g. could not rename file "pg_logical/snapshots/25-3370F40.snap.19943.tmp" to "pg_logical/snapshots/25-3370F40.snap"
PostgresCouldNotRenameSnapshotRe = regexp.MustCompile(`could not rename file ".*\.snap\..*\.tmp" to ".*\.snap"`)
PostgresNeonDonorWalLaggingRe = regexp.MustCompile(`requested WAL up to [0-9A-F]+/[0-9A-F]+, but current donor \S+ has only up to`)
MySqlRdsBinlogFileNotFoundRe = regexp.MustCompile(`File '/rdsdbdata/log/binlog/mysql-bin-changelog.\d+' not found`)
MongoPoolClearedErrorRe = regexp.MustCompile(`connection pool for .+ was cleared because another operation failed with`)
)
Expand Down Expand Up @@ -612,6 +613,9 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
if strings.Contains(pgErr.Message, "lost synchronization with server") {
return ErrorRetryRecoverable, pgErrorInfo
}
if PostgresNeonDonorWalLaggingRe.MatchString(pgErr.Message) {
return ErrorRetryRecoverable, pgErrorInfo
}
}

if strings.Contains(pgErr.Message, "invalid memory alloc request size") {
Expand Down
21 changes: 21 additions & 0 deletions flow/alerting/classifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,27 @@ func TestNeonProjectQuotaExceededErrorShouldBeConnectivity(t *testing.T) {
}, errInfo, "Unexpected error info")
}

func TestNeonDonorWalLaggingErrorShouldBeRecoverable(t *testing.T) {
// Simulate Neon's walsender failing to read WAL because the donor safekeeper is lagging behind
err := &exceptions.PostgresWalError{
Msg: &pgproto3.ErrorResponse{
Severity: "ERROR",
Code: pgerrcode.InternalError,
Message: "[walsender] Failed to read WAL (req_lsn=0/DD7D4000, len=8192): closing remote connection: " +
"requested WAL up to 0/DD7D6000, but current donor xxx.aws.neon.tech:6401 has only up to 0/DD7D5FF8",
File: "walsender_hooks.c",
Line: 144,
Routine: "NeonWALPageRead",
},
}
errorClass, errInfo := GetErrorClass(t.Context(), fmt.Errorf("error in WAL: %w", err))
assert.Equal(t, ErrorRetryRecoverable, errorClass)
assert.Equal(t, ErrorInfo{
Source: ErrorSourcePostgres,
Code: pgerrcode.InternalError,
}, errInfo)
}

func TestPostgresMemoryAllocErrorShouldBeSlotMemalloc(t *testing.T) {
// Simulate a Postgres memory allocation error
err := &exceptions.PostgresWalError{
Expand Down
Loading