Skip to content

Commit 3e220c5

Browse files
authored
all QRepSync as ErrorNotifyMVOrView, mysql ER_NO_SUCH_TABLE (#3392)
1 parent 83e5dc3 commit 3e220c5

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

flow/alerting/classifier.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import (
44
"context"
55
"crypto/tls"
66
"errors"
7-
"fmt"
87
"io"
9-
"log/slog"
108
"net"
119
"regexp"
1210
"strconv"
@@ -165,6 +163,7 @@ var (
165163
ErrorNotifyPostgresSlotMemalloc = ErrorClass{
166164
Class: "NOTIFY_POSTGRES_SLOT_MEMALLOC", action: NotifyUser,
167165
}
166+
// Mongo specific, equivalent to slot invalidation in Postgres
168167
ErrorNotifyChangeStreamHistoryLost = ErrorClass{
169168
Class: "NOTIFY_CHANGE_STREAM_HISTORY_LOST", action: NotifyUser,
170169
}
@@ -418,6 +417,8 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
418417
return ErrorRetryRecoverable, myErrorInfo
419418
}
420419
return ErrorOther, myErrorInfo
420+
case 1146: // ER_NO_SUCH_TABLE
421+
return ErrorNotifySourceTableMissing, myErrorInfo
421422
default:
422423
return ErrorOther, myErrorInfo
423424
}
@@ -509,17 +510,8 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
509510
}
510511
var qrepSyncError *exceptions.QRepSyncError
511512
if errors.As(err, &qrepSyncError) {
512-
unexpectedSelectRe, reErr := regexp.Compile(
513-
fmt.Sprintf(`FROM\s+(%s\.)?%s`,
514-
regexp.QuoteMeta(qrepSyncError.DestinationDatabase), regexp.QuoteMeta(qrepSyncError.DestinationTable)))
515-
if reErr != nil {
516-
slog.Error("regexp compilation error while checking for err", "err", reErr, "original_err", err)
517-
return ErrorOther, chErrorInfo
518-
}
519-
// Select query from destination table in QRepSync errors = MV error
520-
if unexpectedSelectRe.MatchString(chException.Message) {
521-
return ErrorNotifyMVOrView, chErrorInfo
522-
}
513+
// could cause false positives, but should be rare
514+
return ErrorNotifyMVOrView, chErrorInfo
523515
}
524516
case chproto.ErrQueryWasCancelled, chproto.ErrPocoException, chproto.ErrCannotReadFromSocket:
525517
return ErrorRetryRecoverable, chErrorInfo

0 commit comments

Comments
 (0)