Skip to content

Commit

Permalink
Merge pull request #328 from cashapp/mtocker-fix-checkpoint
Browse files Browse the repository at this point in the history
Use dbconn.Exec in checkpoint
  • Loading branch information
morgo authored Jul 8, 2024
2 parents 09b3d2b + fbbd7e8 commit a397dfe
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/migration/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -896,10 +896,16 @@ func (r *Runner) dumpCheckpoint(ctx context.Context) error {
// We believe this is OK but may change it in the future. Please do not
// add any other fields to this log line.
r.logger.Infof("checkpoint: low-watermark=%s log-file=%s log-pos=%d rows-copied=%d rows-copied-logical=%d", lowWatermark, binlog.Name, binlog.Pos, copyRows, logicalCopyRows)
query := fmt.Sprintf("INSERT INTO %s (low_watermark, binlog_name, binlog_pos, rows_copied, rows_copied_logical, alter_statement) VALUES (?, ?, ?, ?, ?, ?)",
r.checkpointTable.QuotedName)
_, err = r.db.ExecContext(ctx, query, lowWatermark, binlog.Name, binlog.Pos, copyRows, logicalCopyRows, r.migration.Alter)
return err
return dbconn.Exec(ctx, r.db, "INSERT INTO %n.%n (low_watermark, binlog_name, binlog_pos, rows_copied, rows_copied_logical, alter_statement) VALUES (%?, %?, %?, %?, %?, %?)",
r.checkpointTable.SchemaName,
r.checkpointTable.TableName,
lowWatermark,
binlog.Name,
binlog.Pos,
copyRows,
logicalCopyRows,
r.migration.Alter,
)
}

func (r *Runner) dumpCheckpointContinuously(ctx context.Context) {
Expand Down

0 comments on commit a397dfe

Please sign in to comment.