On 2008-01-22 20:54, Dieter Maurer wrote: > M.-A. Lemburg wrote at 2008-1-22 20:31 +0100: >> ... >> Branch ids are used for e.g. multiple connections of the same RM >> engaging in a global transaction. Each of those connections gets >> its own branch id. > > But using multiple connections to the same RM seems to > be an error in the first place. > > Assume that a resource "R" is locked via connection "C1". > Assume than that "R" is requested via connection "C2". > > If "C1 == C2", then the RM can see that the resource is already > assigned to the connection and there is no blocking. > > Otherwise, the RM has not chance to recognize this and > the request will be blocked until the transaction is commited > or rolled back. There is quite a high chance, that since the > "R" request is blocked, there will be no commit/roll back....
This situation is well possible, but it's still a rather common case: if an application uses multiple threads, then each of the threads will have its own connection and branch id. It's less common in the Python world (well, maybe for Zope), but very common in Java and C++ applications. Note that it's also possible that even though a connection is registered with the TM, the current global transaction doesn't affect it (e.g. because it's not executing anything at the time). It can then optimize the .tpc_commit()/ .tpc_rollback() method call (by ignoring them). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jan 22 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig