[ZODB-Dev] simple example of undo( )

Jeremy Hylton jeremy@alum.mit.edu
Mon, 23 Sep 2002 20:41:20 -0400


>>>>> "CR" == Christian Reis <kiko@async.com.br> writes:

  CR> On Mon, Sep 23, 2002 at 08:08:52PM -0400, Jeremy Hylton wrote:
  >> conn.sync()
  >>
  >> I can't give you a better answer yet.  I'll need to get some help
  >> from some Zope experts.  The problem, in a nutshell, is that the
  >> undo() transaction operates on the database, but not on your
  >> current connection.  When it commits, the database sends an
  >> invalidation

  CR> abort() works in the same fashion. IIRC is has been said this is
  CR> by design, as sync() invalidates all objects that are live at
  CR> that point in time, and this would be considered rude by many
  CR> applications (our included).

sync() just invalidates all out of date objects in use by the current
connection.  Is that really rude?  They are out of date <0.5 wink>.

It seems odd to me because undo() doesn't do anything until a
transaction commits.  Normally when a connection commits a
transaction, it handles all the pending invalidations.  It's just the
undo transaction that's special, because it operates via the DB
instead of via the Connection.

  >> The sync() method makes this happen explicitly, but I wonder why
  >> there isn't some other implicit mechanism.

  CR> Can we send per-instance invalidation messages? If we can't,
  CR> then I surmise that may be the reason why it's not done
  CR> implicitly.

How would you know what objects to invalidate?

Jeremy