Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions flow/alerting/classifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ const (
MongoShutdownInProgress = "(ShutdownInProgress) The server is in quiesce mode and will shut down"
MongoInterruptedDueToReplStateChange = "(InterruptedDueToReplStateChange) operation was interrupted"
MongoIncompleteReadOfMessageHeader = "incomplete read of message header"

// MySQLGeometryLinearRingNotClosedError is the specific WKB parse failure raised by the geom
// library when a LinearRing's points do not close.
MySQLGeometryLinearRingNotClosedError = "Points of LinearRing do not form a closed linestring"
)

var (
Expand Down Expand Up @@ -1101,6 +1105,13 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
}
}

if strings.Contains(err.Error(), MySQLGeometryLinearRingNotClosedError) {
Comment thread
Jeremyyang920 marked this conversation as resolved.
Outdated
return ErrorUnsupportedDatatype, ErrorInfo{
Comment thread
Jeremyyang920 marked this conversation as resolved.
Source: ErrorSourceMySQL,
Comment thread
Jeremyyang920 marked this conversation as resolved.
Code: "UNSUPPORTED_GEOMETRY_LINEAR_RING_NOT_CLOSED",
}
}

var postgresPrimaryKeyModifiedError *exceptions.PrimaryKeyModifiedError
if errors.As(err, &postgresPrimaryKeyModifiedError) {
return ErrorUnsupportedSchemaChange, ErrorInfo{
Expand Down
11 changes: 11 additions & 0 deletions flow/alerting/classifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,3 +993,14 @@ func TestClickHouseStdExceptionObjectStorageIOErrorShouldBeRecoverable(t *testin
Code: strconv.Itoa(int(chproto.ErrStdException)),
}, errInfo)
}

func TestMySQLGeometryLinearRingNotClosedShouldBeUnsupportedDatatype(t *testing.T) {
err := fmt.Errorf("failed to parse geometry WKB: %w",
fmt.Errorf("IllegalArgumentException: %s", MySQLGeometryLinearRingNotClosedError))
errorClass, errInfo := GetErrorClass(t.Context(), fmt.Errorf("mysql error: %w", err))
assert.Equal(t, ErrorUnsupportedDatatype, errorClass)
assert.Equal(t, ErrorInfo{
Source: ErrorSourceMySQL,
Code: "UNSUPPORTED_GEOMETRY_LINEAR_RING_NOT_CLOSED",
}, errInfo)
}
Loading