Skip to content

Commit 645113b

Browse files
committed
add errorAdditionalAttributeTable
1 parent cbf661c commit 645113b

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

flow/alerting/classifier.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,10 +1122,13 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
11221122
}
11231123
}
11241124

1125-
if _, ok := errors.AsType[*exceptions.MySQLUnsupportedBinlogRowValueOptionsError](err); ok {
1125+
if partialJsonUnsupportedError, ok := errors.AsType[*exceptions.MySQLUnsupportedBinlogRowValueOptionsError](err); ok {
11261126
return ErrorNotifyBinlogPartialJsonUnsupported, ErrorInfo{
11271127
Source: ErrorSourceMySQL,
1128-
Code: "UNSUPPORTED_BINLOG_ROW_VALUE_OPTIONS",
1128+
Code: "UNSUPPORTED_PARTIAL_JSON",
1129+
AdditionalAttributes: map[AdditionalErrorAttributeKey]string{
1130+
ErrorAttributeKeyTable: fmt.Sprintf("%s.%s", partialJsonUnsupportedError.Schema, partialJsonUnsupportedError.Table),
1131+
},
11291132
}
11301133
}
11311134

flow/alerting/classifier_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,9 @@ func TestMySQLUnsupportedBinlogRowValueOptionsErrorShouldBeNotifyBinlogPartialJs
12521252
assert.Equal(t, ErrorNotifyBinlogPartialJsonUnsupported, errorClass)
12531253
assert.Equal(t, ErrorInfo{
12541254
Source: ErrorSourceMySQL,
1255-
Code: "UNSUPPORTED_BINLOG_ROW_VALUE_OPTIONS",
1255+
Code: "UNSUPPORTED_PARTIAL_JSON",
1256+
AdditionalAttributes: map[AdditionalErrorAttributeKey]string{
1257+
ErrorAttributeKeyTable: "mydb.mytable",
1258+
},
12561259
}, errInfo)
12571260
}

flow/shared/exceptions/mysql.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ func (e *MySQLUnsupportedBinlogRowMetadataError) Error() string {
5656
}
5757

5858
type MySQLUnsupportedBinlogRowValueOptionsError struct {
59-
SchemaName string
60-
TableName string
59+
Schema string
60+
Table string
6161
}
6262

6363
func NewMySQLUnsupportedBinlogRowValueOptionsError(schema string, table string) *MySQLUnsupportedBinlogRowValueOptionsError {
64-
return &MySQLUnsupportedBinlogRowValueOptionsError{SchemaName: schema, TableName: table}
64+
return &MySQLUnsupportedBinlogRowValueOptionsError{Schema: schema, Table: table}
6565
}
6666

6767
func (e *MySQLUnsupportedBinlogRowValueOptionsError) Error() string {
6868
return fmt.Sprintf(
6969
"Received a partial JSON update event while processing %s.%s; binlog_row_value_options must be disabled (set to '')",
70-
e.SchemaName, e.TableName)
70+
e.Schema, e.Table)
7171
}
7272

7373
type MySQLUnsupportedDDLError struct {

0 commit comments

Comments
 (0)