[ZODB-Dev] problem with aborting read-committed transaction

Adam Groszer adamg at mailbox.hu
Mon Apr 28 12:47:38 EDT 2003


Dear Dieter,

_start is working fine now.

But I have again a small problem:
I have a hook (in a subclassed connection) in all transaction messages,
which in turn forward the messages to my persistent objects. I'm doing this
because I have to do some checking and registering with the objects.

I 'start' the transaction, 'do something'.
If everything goes well the transaction commits, my objects get the
following messages:
	tpc_begin
	commit
	tpc_vote
	tpc_finish
fine. If something goes wrong in the checking (done in tpc_begin) the
following:
	tpc_begin (exception raised)
	abort
	tpc_abort
fine. If I want to abort, not commit the modifications the following:
	abort
	tpc_begin
now my code is wondering what's happening...

I found that the message order is the above because:
                # DM: inform the jars that the transaction was aborted
                #     such that they can refresh their state
                #     ATT: this may require a new method as
                #       "tpc_abort" may not be allowed

                # do we need to merge in "subjars"?
                for jar in jars:
                    jar.tpc_begin(self)
                    jar.tpc_abort(self)
the un-patched ZODB would send the following messages (I think):
	abort
	and nothing else?

What do you mean,
	- is it OK to manipulate some objects in tpc_begin?
	- should I write some work-around for the above?
When does ZODB 'restore' the previous state of the modified object, on which
message?

Adam




More information about the ZODB-Dev mailing list