I did this earlier with an asynchronous threaded dataflow package I wrote on top of elephant and it worked great. For the internal problem that Alex outlines, it just shouldn't happen and I know how to work around it. However, it would be good to have a general extension allowing users to rollback non-db side effects on an abort.

Perhaps this could be a simple extension to the with-transaction syntax? :on-abort sym|expr :on-commit sym|expr. Lambda expressions would be compiled, symbols could refer to external functions much like we handle keys on indexed-btrees. It would be nice to have a more automated way of catching side effects though, but I think it's impractical.

(Actually my little process components package allows you to define and use a set of lisp variables visible to a body expression. The package rewrote the body expression so that all side effected lisp variables were cached and only saved on a commit - function calls outside the body had to be handled explicitly though).

Anyone want to bite? It's a great little addition to Elephant and shouldn't be too much work, at least once you understand all the subtleties of the transaction macros and methods. I can help if you get stuck.

Henrik, want to add a ticket if no one decides to do this in the near term?

Ian

On Mar 11, 2008, at 10:52 AM, Henrik Hjelte wrote:

On Tue, Mar 11, 2008 at 11:18 AM, Alex Mizrahi <[EMAIL PROTECTED]> wrote:

find-inverted-index does two things: creates DB object representing index
and caches it.
then transaction is aborted -- all DB changes are effectively wiped.
but we still have references to DB object in %index-cache, and accessing
it's slots produces errors:

A quick idea:
Can't elephant keep a list of lambda forms to be executed at commit
and perhaps a list of lambda forms to be executed at abort. Then
instead of directly caching it, you can make a lambda form that does
the caching, and push it to the list of commit actions. This will
defer execution of it to a safer time.

/Henrik
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

Reply via email to