Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more logging to sharding key comparison parsing #370

Merged
merged 1 commit into from
Dec 9, 2024
Merged
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
30 changes: 29 additions & 1 deletion sharding/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,39 @@ func (f *ShardedCopyFilter) ApplicableEvent(event ghostferry.DMLEvent) (bool, er

oldShardingValue, oldExists, err := parseShardingValue(oldValues, idx)
if err != nil {

sql, sqlErr := event.AsSQLString(event.Database(), event.Table())
if sqlErr != nil {
sql = ""
}

log.WithFields(log.Fields{
"tag": "sharding",
"table": event.Table(),
"position": event.BinlogPosition(),
"sqlStatement": sql,
"event": fmt.Sprintf("%T", event),
}).WithError(err).Error("parsing old sharding key failed")

return false, fmt.Errorf("parsing old sharding key: %s", err)
}

newShardingValue, newExists, err := parseShardingValue(newValues, idx)
if err != nil {

sql, sqlErr := event.AsSQLString(event.Database(), event.Table())
if sqlErr != nil {
sql = ""
}

log.WithFields(log.Fields{
"tag": "sharding",
"table": event.Table(),
"position": event.BinlogPosition(),
"sqlStatement": sql,
"event": fmt.Sprintf("%T", event),
}).WithError(err).Error("parsing new sharding key failed")

return false, fmt.Errorf("parsing new sharding key: %s", err)
}

Expand Down Expand Up @@ -215,7 +243,7 @@ func (s *ShardedTableFilter) ApplicableDatabases(dbs []string) ([]string, error)

func (s *ShardedTableFilter) ApplicableTables(tables []*ghostferry.TableSchema) (applicable []*ghostferry.TableSchema, err error) {
for _, table := range tables {
if ((s.isIgnoreFilter() && s.isPresent(table)) || (s.isIncludeFilter() && !s.isPresent(table))) {
if (s.isIgnoreFilter() && s.isPresent(table)) || (s.isIncludeFilter() && !s.isPresent(table)) {
mtaner marked this conversation as resolved.
Show resolved Hide resolved
continue
}

Expand Down
Loading