On 8 May 2011, at 18:41, yanosz <[email protected]> wrote:

> Hello,
> 
> I'm having trouble with transactions with rails 3.0.3 and mysql 5. I'd
> like to import data etl-batch-style:
> class Job < ActiveRecord::Base
>  # ...
>  def perform_etl
>    connection.transaction do
>      extract # some connection.execute / job.update_attribute stuff
>      transform # some connection.execute / job.update_attribute stuff
>    end
>  end
>  #...
> end
> 
> I'm using InnoDB as storage engine and transaction seem to be working
> so far: If I start a job while being logged in before starting that
> job, my session is isolated and I don't see any data.
> But: If the job fails (exeption) there is data in the database -
> although a rollback is performed:
> The rollback itself is logged "SQL (0.1ms)  ROLLBACK" - and no COMMIT
> is logged.
> 
> Is rails perfoming a "ROLLBACKUP TO SAVEPOINT" instead?
> How can I make sure, that no data is written, if a ROLLBACK happens?
> 

Well if the log says rollback then that should be what was executed. Is any non 
transaction safe stuff happening (eg calling begin, altering tables etc) ?

Fred

> Thanks,
> yanosz
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to