|
4 | 4 | "context" |
5 | 5 | "crypto/tls" |
6 | 6 | "errors" |
7 | | - "fmt" |
8 | 7 | "io" |
9 | | - "log/slog" |
10 | 8 | "net" |
11 | 9 | "regexp" |
12 | 10 | "strconv" |
@@ -165,6 +163,7 @@ var ( |
165 | 163 | ErrorNotifyPostgresSlotMemalloc = ErrorClass{ |
166 | 164 | Class: "NOTIFY_POSTGRES_SLOT_MEMALLOC", action: NotifyUser, |
167 | 165 | } |
| 166 | + // Mongo specific, equivalent to slot invalidation in Postgres |
168 | 167 | ErrorNotifyChangeStreamHistoryLost = ErrorClass{ |
169 | 168 | Class: "NOTIFY_CHANGE_STREAM_HISTORY_LOST", action: NotifyUser, |
170 | 169 | } |
@@ -418,6 +417,8 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) { |
418 | 417 | return ErrorRetryRecoverable, myErrorInfo |
419 | 418 | } |
420 | 419 | return ErrorOther, myErrorInfo |
| 420 | + case 1146: // ER_NO_SUCH_TABLE |
| 421 | + return ErrorNotifySourceTableMissing, myErrorInfo |
421 | 422 | default: |
422 | 423 | return ErrorOther, myErrorInfo |
423 | 424 | } |
@@ -509,17 +510,8 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) { |
509 | 510 | } |
510 | 511 | var qrepSyncError *exceptions.QRepSyncError |
511 | 512 | 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 |
523 | 515 | } |
524 | 516 | case chproto.ErrQueryWasCancelled, chproto.ErrPocoException, chproto.ErrCannotReadFromSocket: |
525 | 517 | return ErrorRetryRecoverable, chErrorInfo |
|
0 commit comments