Skip to content

Commit

Permalink
mysql(ticdc): fix wrong dml order when batch DML is enabled (#8553) (#…
Browse files Browse the repository at this point in the history
…8582)

close #8552
  • Loading branch information
ti-chi-bot authored Mar 22, 2023
1 parent 4b60531 commit e5255f8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions cdc/sink/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,18 @@ func (s *mysqlSink) batchSingleTxnDmls(
}
}

// handle update
if len(updateRows) > 0 {
// TODO: use sql.GenUpdateSQL to generate update sql after we optimize the func.
for _, rows := range updateRows {
for _, row := range rows {
sql, value := row.GenSQL(sqlmodel.DMLUpdate)
sqls = append(sqls, sql)
values = append(values, value)
}
}
}

// handle insert
if len(insertRows) > 0 {
for _, rows := range insertRows {
Expand All @@ -927,18 +939,6 @@ func (s *mysqlSink) batchSingleTxnDmls(
}
}

// handle update
if len(updateRows) > 0 {
// TODO: use sql.GenUpdateSQL to generate update sql after we optimize the func.
for _, rows := range updateRows {
for _, row := range rows {
sql, value := row.GenSQL(sqlmodel.DMLUpdate)
sqls = append(sqls, sql)
values = append(values, value)
}
}
}

return
}

Expand Down

0 comments on commit e5255f8

Please sign in to comment.