Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions cdc/entry/schema_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ func (s *schemaStorage) buildRenameEvents(
tableInfo := model.WrapTableInfo(info.NewSchemaID, newSchemaName,
job.BinlogInfo.FinishedTS, tableInfo)
event.FromJobWithArgs(job, preTableInfo, tableInfo, oldSchemaName, newSchemaName)
event.Seq = uint64(i)
ddlEvents = append(ddlEvents, event)
}
return ddlEvents, nil
Expand Down
4 changes: 4 additions & 0 deletions cdc/model/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,10 @@ type DDLEvent struct {
// the DDL is executed by the primary cluster.
BDRRole string `msg:"-"`
SQLMode mysql.SQLMode `msg:"-"`
// Seq is used to order the DDLs with the same commit ts
// Only used in the splited DDLEvent generated by a multi-table DDL,
// we need to keep the order of the original multi-table DDL
Seq uint64 `msg:"seq"`
}

// FromJob fills the values with DDLEvent from DDL job
Expand Down
162 changes: 43 additions & 119 deletions cdc/model/sink_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cdc/owner/ddl_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ func (m *ddlManager) getNextDDL() *model.DDLEvent {
delete(m.pendingDDLs, tb)
continue
}
if res == nil || res.CommitTs > ddls[0].CommitTs {
if res == nil || res.CommitTs > ddls[0].CommitTs || (res.CommitTs == ddls[0].CommitTs && res.Seq > ddls[0].Seq) {
res = ddls[0]
}
}
Expand Down