[CDBI] Re: aborting transactions and clearing the live object index

Bill Moseley moseley at hank.org
Wed Oct 19 20:24:33 BST 2005


On Wed, Oct 19, 2005 at 03:05:59PM -0400, Edward J. Sabol wrote:
> Bill Moseley wrote:
> > I'm using the transaction example from the wiki[1] and one thing
> > I'm wondering is if on failed transactions it should do
> >
> > $class->clear_object_index;
> >
> > Or, really the question is: is there's a reason that should not be done?
> 
> That's an excellent point! Clearing the entire object index seems like
> overkill. Ideally, you should only need to clear out the objects that were
> affected in the transaction, but I suppose that could be hard to determine in
> some cases, so perhaps just clearing the whole object index is the best thing
> to do?

I don't expect transactions to fail.  I try and look for problems
before running the transaction.  So the overhead of clearing the
entire index/cache shouldn't happen too often.

Under catalyst, where the croak is caught and an error is displayed.
It's odd to then make a request for showing that item again and see the
incorrect column data displayed.  Confusing because the error said
that the database couldn't be updated (e.g. due to text in an integer
column), but now it's showing that data.

Maybe others are using do_transaction in a different way?


-- 
Bill Moseley
moseley at hank.org





More information about the ClassDBI mailing list