To edit pages or tickets please login with username/password: aaf/aaf

Ticket #179 (assigned enhancement)

Opened 1 year ago

Last modified 7 months ago

Index updated even if database transaction rolled back

Reported by: aaf Assigned to: jk (accepted)
Priority: major Milestone: later
Component: 0plugin Version:
Keywords: Cc: gabriel.burt@gmail.com, jk@jkraemer.net, jonathan.viney@gmail.com

Description

If you modify a few items within a transaction, eg

Model.transaction do
  a = Model.new.save! # valid, saves, ferret entry created
  b = Model.new(:title => 'invalid').save! # invalid, doesn't save, ferret entry not created
end

a was saved, but is rolled back when the transaction is left due to b throwing an exception.

However, the ferret index has an entry for a.

Attachments

aaf_transactions.rb (2.8 kB) - added by aaf on 10/18/07 20:32:34.
File that hooks into AR and aaf to delay modifying the index until the transaction commits
acts_as_ferret_test.rb (3.4 kB) - added by aaf on 10/18/07 20:34:29.
Unit test that fails without the above fix, passes with it. (Requires some simple model files that aren't included)

Change History

10/18/07 20:32:34 changed by aaf

  • attachment aaf_transactions.rb added.

File that hooks into AR and aaf to delay modifying the index until the transaction commits

10/18/07 20:33:25 changed by aaf

  • cc set to gabriel.burt@gmail.com.

10/18/07 20:34:29 changed by aaf

  • attachment acts_as_ferret_test.rb added.

Unit test that fails without the above fix, passes with it. (Requires some simple model files that aren't included)

10/21/07 08:49:44 changed by jk

Wow, cool stuff. Do you see any chance to generalize this so it applies to non-MySQL databases, too?

10/21/07 08:50:15 changed by jk

  • cc changed from gabriel.burt@gmail.com to gabriel.burt@gmail.com, jk@jkraemer.net.

12/16/07 20:49:54 changed by jk

  • status changed from new to assigned.
  • type changed from defect to enhancement.
  • milestone set to later.

03/26/08 05:08:24 changed by aaf

  • cc changed from gabriel.burt@gmail.com, jk@jkraemer.net to gabriel.burt@gmail.com, jk@jkraemer.net, jonathan.viney@gmail.com.

To edit pages or tickets please login with username/password: aaf/aaf