[Zope-Checkins] CVS: Zope3/src/ZODB - Connection.py:1.140.2.4

Tim Peters tim.one at comcast.net
Tue Mar 30 11:48:03 EST 2004


Update of /cvs-repository/Zope3/src/ZODB
In directory cvs.zope.org:/tmp/cvs-serv1022/src/ZODB

Modified Files:
      Tag: jeremy-txn-branch
	Connection.py 
Log Message:
Connection.commit():  if oid is in self._conflicts, stop registering the
object before raising ReadConflictError.  The object must already be
registered (it's a conflict), and tying to register it again causes an
assert to fail often in the MappingStorage flavor (which doesn't support
MVCC) of check7ZODBThreads.


=== Zope3/src/ZODB/Connection.py 1.140.2.3 => 1.140.2.4 ===
--- Zope3/src/ZODB/Connection.py:1.140.2.3	Mon Mar 29 14:15:19 2004
+++ Zope3/src/ZODB/Connection.py	Tue Mar 30 11:47:52 2004
@@ -81,7 +81,7 @@
 
     In many applications, root() is the only method of the Connection
     that you will need to use.
-    
+
     Synchronization
     ---------------
 
@@ -106,7 +106,7 @@
     XXX Mention the database pool.
 
     :Groups:
-    
+
       - `User Methods`: root, get, add, close, db, sync, isReadOnly,
         cacheGC, cacheFullSweep, cacheMinimize, getVersion,
         modifiedInVersion
@@ -251,7 +251,7 @@
         if self._storage is None:
             # XXX Should this be a ZODB-specific exception?
             raise RuntimeError("The database connection is closed")
-        
+
         obj = self._cache.get(oid, None)
         if obj is not None:
             return obj
@@ -300,7 +300,7 @@
         if self._storage is None:
             # XXX Should this be a ZODB-specific exception?
             raise RuntimeError("The database connection is closed")
-        
+
         marker = object()
         oid = getattr(obj, "_p_oid", marker)
         if oid is marker:
@@ -334,7 +334,7 @@
         was closed will be processed.
 
         If resetCaches() was called, the cache will be cleared.
-        
+
         :Parameters:
           - `odb`: that database that owns the Connection
         """
@@ -343,7 +343,7 @@
         # other attributes on open and clearing them on close?
         # A Connection is only ever associated with a single DB
         # and Storage.
-        
+
         self._db = odb
         self._storage = odb._storage
         self._sortKey = odb._storage.sortKey
@@ -415,7 +415,7 @@
 
     def cacheGC(self):
         """Reduce cache size to target size.
-        
+
         Call _p_deactivate() on cached objects until the cache size
         falls under the target size.
         """
@@ -478,7 +478,6 @@
 
         oid = obj._p_oid
         if oid in self._conflicts:
-            self.getTransaction().register(obj)
             raise ReadConflictError(object=obj)
 
         if oid is None or obj._p_jar is not self:
@@ -543,7 +542,7 @@
         src = self._storage
         self._storage = self._tmp
         self._tmp = None
-        
+
         self._log.debug("Commiting subtransaction of size %s", src.getSize())
         oids = src._index.keys()
         self._storage.tpc_begin(t)
@@ -609,7 +608,7 @@
         :Parameters:
           - `tid`: the storage-level id of the transaction that committed
           - `oids`: oids is a set of oids, represented as a dict with oids
-            as keys. 
+            as keys.
         """
         self._inv_lock.acquire()
         try:
@@ -649,7 +648,7 @@
             # There is some old Zope code that assigns _p_jar
             # directly.  That is no longer allowed, but we need to
             # provide support for old code that still does it.
-            
+
             # XXX The actual complaint here is that an object without
             # an oid is being registered.  I can't think of any way to
             # achieve that without assignment to _p_jar.  If there is
@@ -791,7 +790,7 @@
         to other peristent objects are handled.
 
         :return: a persistent object
-        
+
         :Parameters:
           - `obj`: a persistent object from this Connection.
           - `tid`: id of a transaction that wrote an earlier revision.
@@ -840,7 +839,7 @@
 
     def tpc_begin(self, transaction, sub=False):
         self._modified = []
-        
+
         # _creating is a list of oids of new objects, which is used to
         # remove them from the cache if a transaction aborts.
         self._creating = []




More information about the Zope-Checkins mailing list