[ZODB-Dev] Re: [Zope-dev] Zope 2.4.0 CopySupport changes seem wrong

JohnD.Heintz JohnD.Heintz
Fri, 27 Jul 2001 12:43:12 -0500


Steve:

On Friday 27 July 2001 11:12, Steve Alexander wrote:
> Hi John,
>
> John D.Heintz wrote:
> > I'll offer any help I can to you.
>
> Thanks. That's much appreciated.
>
> > I have some ideas to contribute, all of which have been coded into th=
e
> > TransactionManagement.py file include in ZCF 0.5.
> > See: http://www.zope.org/Members/jheintz/ZODB_CORBA_Connection/index_=
html
>
> I'll take a look at this.
>
> >     def attach(self, _id=3Dthread.get_ident, force=3D0):
> >           "map _id() to this transactions for get_transaction(_id)"
> >
> >     def detach(self, _id=3Dthread.get_ident):
> >           "un-map _id() to this transactions for get_transaction(_id)=
"
>
> So I guess this is for having many threads to one transaction. I suppos=
e
> that's important for the way CORBA works.

Yes, exactly.

>
> > def registerCommitCallback(self, func, *args, **kw):
> >       "Register callback when Transaction has totally finished commit=
"
>
> Does this run only on a successful finished commit, or does it run on
> anything that causes tpc_finish?
>
> > def commit(self, subtransaction=3DNone):
> >     ZODB.Transaction.Transaction.commit(self, subtransaction)
> >     if subtransaction is None and self._onCommitCallbacks is not None=
:
> >         for callback, args, kw in self._onCommitCallbacks:
> >             try:
> >                 apply(callback, args, kw)
> >             except:
> >                 LOG('ThorTransaction',ERROR, 'Error processing ?'
> >                         callbacks',
> >                         error=3Dsys.exc_info())
> >             self._onCommitCallbacks =3D None
>
> I guess I can answer my own question -- you only run this on a
> successful commit. What commits the work done in the callbacks?

In our use the "callbacks" trigger calls to a remote CORBA process=20
responsible for full-text indexing new content in our system.  The remote=
=20
CORBA process connects into our system via the same CORBA exposure an thu=
s=20
works in its own Transaction/Connection.

>
> > Note:  The reason we needed postCommit() and registerCommitCallback()
> > was that some of our _finish() processing was trying to send the ID o=
f
> > a newly created object to an external system that was synchronously
> > calling back into  our ZODB (on another connection) and was unable to
> > find the new object.  This was the side-effect that until all of the
> > finish() calls have been made a callback like this will likely fail.
>
> I had a similar problem with a race condition when I wanted to
> invalidate a RAM Cache Manager after certain things had changed in a
> transaction. I solved it by running the invalidation in a separate
> transaction that runs after the original transaction is completely
> successfully committed.

Our solution results in the same things, our remote process has its own=20
Session and therefore Transaction/Connection.

>
>
> --
> Steve Alexander
> Software Engineer
> Cat-Box limited
>
>
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
>
> ZODB-Dev mailing list  -  ZODB-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zodb-dev

--=20
=2E . . . . . . . . . . . . . . . . . . . . . . .

John D. Heintz | Senior Engineer

1016 La Posada Dr. | Suite 240 | Austin TX 78752
T 512.633.1198 | jheintz@isogen.com

w w w . d a t a c h a n n e l . c o m