diff --git a/cdc/sink/mysql/mysql_syncpoint_store.go b/cdc/sink/mysql/mysql_syncpoint_store.go index 5da5176fcb4..5e1d447911e 100644 --- a/cdc/sink/mysql/mysql_syncpoint_store.go +++ b/cdc/sink/mysql/mysql_syncpoint_store.go @@ -243,12 +243,14 @@ func (s *mysqlSyncPointStore) SinkSyncPoint(ctx context.Context, s.syncPointRetention.Seconds()) _, err = tx.Exec(query) if err != nil { - // It is ok to ignore the error, since it will not affect the correctness of the system, - // and no any business logic depends on this behavior, so we just log the error. - log.Error("failed to clean syncpoint table", zap.Error(cerror.WrapError(cerror.ErrMySQLTxnError, err))) - } else { - s.lastCleanSyncPointTime = time.Now() + err2 := tx.Rollback() + // It is ok to ignore the error, since clear sync point is not necessary. + if err2 != nil { + log.Error("failed to clean syncpoint table", zap.Error(cerror.WrapError(cerror.ErrMySQLTxnError, err2))) + } } + s.lastCleanSyncPointTime = time.Now() + log.Info("clean outdate syncpoint successfully", zap.String("query", query)) } err = tx.Commit()