Skip to content

Commit 5ac5713

Browse files
authored
classifier: new error code (#3625)
- add `ErrTableIsReadOnly` which is a recoverable error - group all non-conditional cases of ErrorRetryRecoverable together - always use code variable for consistency
1 parent 299d6c8 commit 5ac5713

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

flow/alerting/classifier.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,6 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
702702
chproto.ErrUnfinished,
703703
chproto.ErrAborted:
704704
return ErrorInternalClickHouse, chErrorInfo
705-
case chproto.ErrAuthenticationFailed:
706-
return ErrorRetryRecoverable, chErrorInfo
707705
case chproto.ErrTooManySimultaneousQueries:
708706
return ErrorIgnoreConnTemporary, chErrorInfo
709707
case chproto.ErrCannotParseUUID, chproto.ErrValueIsOutOfRangeOfDataType: // https://github.com/ClickHouse/ClickHouse/pull/78540
@@ -723,8 +721,6 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
723721
if strings.HasSuffix(chException.Message, "is either DETACHED PERMANENTLY or was just created by another replica") {
724722
return ErrorRetryRecoverable, chErrorInfo
725723
}
726-
case 439: // CANNOT_SCHEDULE_TASK
727-
return ErrorRetryRecoverable, chErrorInfo
728724
case chproto.ErrUnsupportedMethod,
729725
chproto.ErrIllegalColumn,
730726
chproto.ErrDuplicateColumn,
@@ -741,23 +737,26 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
741737
chproto.ErrNotAnAggregate,
742738
chproto.ErrSizesOfArraysDoesntMatch,
743739
chproto.ErrAliasRequired,
744-
691, // UNKNOWN_ELEMENT_OF_ENUM
740+
chproto.ErrUnknownElementOfEnum,
745741
chproto.ErrNoCommonType,
746742
chproto.ErrIllegalTypeOfArgument:
747743
var qrepSyncError *exceptions.QRepSyncError
748744
if errors.As(err, &qrepSyncError) {
749745
// could cause false positives, but should be rare
750746
return ErrorNotifyMVOrView, chErrorInfo
751747
}
752-
case 529: // NOT_A_LEADER
748+
case chproto.ErrNotALeader:
753749
if strings.HasPrefix(chException.Message, "Cannot enqueue query on this replica, because it has replication lag") {
754750
return ErrorNotifyConnectivity, chErrorInfo
755751
}
756-
case chproto.ErrQueryWasCancelled,
752+
case chproto.ErrAuthenticationFailed,
753+
chproto.ErrCannotScheduleTask,
754+
chproto.ErrQueryWasCancelled,
757755
chproto.ErrPocoException,
758756
chproto.ErrCannotReadFromSocket,
759757
chproto.ErrSocketTimeout,
760-
517: // CANNOT_ASSIGN_ALTER
758+
chproto.ErrTableIsReadOnly,
759+
chproto.ErrCannotAssignAlter:
761760
return ErrorRetryRecoverable, chErrorInfo
762761
case chproto.ErrTimeoutExceeded:
763762
if strings.HasSuffix(chException.Message, "distributed_ddl_task_timeout") {

0 commit comments

Comments
 (0)