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 @@ -967,6 +967,10 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
case chproto.ErrUnknownDatabase,
chproto.ErrAuthenticationFailed:
return ErrorNotifyConnectivity, chErrorInfo
case chproto.ErrUnexpectedZookeeperError:
if strings.Contains(chException.Message, "ZNODEEXISTS") {
return ErrorRetryRecoverable, chErrorInfo
}
case chproto.ErrKeeperException:
if chException.Message == "Session expired" || strings.HasPrefix(chException.Message, "Coordination error: Connection loss") {
return ErrorRetryRecoverable, chErrorInfo
Expand Down
14 changes: 14 additions & 0 deletions flow/alerting/classifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,20 @@ func TestClickHouseAccessEntityNotFoundErrorShouldBeRecoverable(t *testing.T) {
}
}

func TestClickHouseUnexpectedZookeeperZnodeExistsErrorShouldBeRecoverable(t *testing.T) {
err := &clickhouse.Exception{
Code: int32(chproto.ErrUnexpectedZookeeperError),
Message: "Got unexpected ZooKeeper error ZNODEEXISTS (at index 10) for part all_0_0_1",
}
errorClass, errInfo := GetErrorClass(t.Context(),
exceptions.NewClickHouseQRepSyncError(fmt.Errorf("failed to sync records: QRepSync Error: %w", err), "", ""))
assert.Equal(t, ErrorRetryRecoverable, errorClass)
assert.Equal(t, ErrorInfo{
Source: ErrorSourceClickHouse,
Code: strconv.Itoa(int(chproto.ErrUnexpectedZookeeperError)),
}, errInfo)
}

func TestClickHouseAccessDeniedErrorShouldBeNotifyPermissions(t *testing.T) {
err := &clickhouse.Exception{
Code: int32(chproto.ErrAccessDenied),
Expand Down
Loading