|
50 | 50 | ) |
51 | 51 | // ID(a14c2a1c-edcd-5fcb-73be-bd04e09fccb7) not found in user directories |
52 | 52 | ClickHouseNotFoundInUserDirsRe = regexp.MustCompile("ID\\([a-z0-9-]+\\) not found in `?user directories`?") |
| 53 | + ClickHouseTooManyPartsTableRe = regexp.MustCompile(`in table '(.+)'\.`) |
53 | 54 | PostgresPublicationDoesNotExistRe = regexp.MustCompile(`publication ".*?" does not exist`) |
54 | 55 | PostgresSnapshotDoesNotExistRe = regexp.MustCompile(`snapshot ".*?" does not exist`) |
55 | 56 | PostgresWalSegmentRemovedRe = regexp.MustCompile(`requested WAL segment \w+ has already been removed`) |
@@ -214,6 +215,9 @@ var ( |
214 | 215 | ErrorNotifyClickHouseSupportIsDisabledError = ErrorClass{ |
215 | 216 | Class: "NOTIFY_CLICKHOUSE_SUPPORT_IS_DISABLED_ERROR", action: NotifyUser, |
216 | 217 | } |
| 218 | + ErrorNotifyTooManyPartsError = ErrorClass{ |
| 219 | + Class: "NOTIFY_TOO_MANY_PARTS", action: NotifyUser, |
| 220 | + } |
217 | 221 | // Catch-all for unclassified errors |
218 | 222 | ErrorOther = ErrorClass{ |
219 | 223 | // These are unclassified and should not be exposed |
@@ -884,6 +888,18 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) { |
884 | 888 | } |
885 | 889 | case chproto.ErrSupportIsDisabled: |
886 | 890 | return ErrorNotifyClickHouseSupportIsDisabledError, chErrorInfo |
| 891 | + case chproto.ErrTooManyParts: |
| 892 | + var additionalAttributes map[AdditionalErrorAttributeKey]string |
| 893 | + if matches := ClickHouseTooManyPartsTableRe.FindStringSubmatch(chException.Message); len(matches) > 1 { |
| 894 | + additionalAttributes = map[AdditionalErrorAttributeKey]string{ |
| 895 | + ErrorAttributeKeyTable: matches[1], |
| 896 | + } |
| 897 | + } |
| 898 | + return ErrorNotifyTooManyPartsError, ErrorInfo{ |
| 899 | + Source: chErrorInfo.Source, |
| 900 | + Code: chErrorInfo.Code, |
| 901 | + AdditionalAttributes: additionalAttributes, |
| 902 | + } |
887 | 903 | } |
888 | 904 | var normalizationErr *exceptions.NormalizationError |
889 | 905 | if isClickHouseMvError(chException) { |
@@ -995,7 +1011,7 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) { |
995 | 1011 | Code: "UNSUPPORTED_SCHEMA_CHANGE", |
996 | 1012 | AdditionalAttributes: map[AdditionalErrorAttributeKey]string{ |
997 | 1013 | ErrorAttributeKeyTable: postgresReplicaIdentityIndexError.Table, |
998 | | - ErrorAttributeKeyColumn: "n\a", |
| 1014 | + ErrorAttributeKeyColumn: "n/a", |
999 | 1015 | }, |
1000 | 1016 | } |
1001 | 1017 | } |
|
0 commit comments