[Zodb-checkins] CVS: Zope/lib/python/ZODB - Connection.py:1.72.6.6

Jeremy Hylton jeremy at zope.com
Tue Jun 10 11:35:30 EDT 2003


Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv23131

Modified Files:
      Tag: Zope-2_6-branch
	Connection.py 
Log Message:
Critical bug fix: Objects involved in conflict resolution must be ghostified.


=== Zope/lib/python/ZODB/Connection.py 1.72.6.5 => 1.72.6.6 ===
--- Zope/lib/python/ZODB/Connection.py:1.72.6.5	Wed Apr 30 17:25:51 2003
+++ Zope/lib/python/ZODB/Connection.py	Tue Jun 10 10:35:29 2003
@@ -694,19 +694,26 @@
         # tpc_vote() calls already did this.  The change=1 argument
         # exists to allow commit_sub() to avoid setting the flag
         # again.
+
+        # When conflict resolution occurs, the object state held by
+        # the connection does not match what is written to the
+        # database.  Invalidate the object here to guarantee that
+        # the new state is read the next time the object is used.
+        
         if not store_return:
             return
         if isinstance(store_return, StringType):
+            # This code is duplicated in the body of the for loop below.
             assert oid is not None
             serial = store_return
             obj = self._cache.get(oid, None)
             if obj is None:
                 return
             if serial == ResolvedSerial:
-                obj._p_changed = None
+                del obj._p_changed # transition from changed to ghost
             else:
                 if change:
-                    obj._p_changed = 0
+                    obj._p_changed = 0 # transition from changed to uptodate
                 obj._p_serial = serial
         else:
             for oid, serial in store_return:
@@ -716,10 +723,10 @@
                 if obj is None:
                     continue
                 if serial == ResolvedSerial:
-                    obj._p_changed = None
+                    del obj._p_changed # transition from changed to ghost
                 else:
                     if change:
-                        obj._p_changed = 0
+                        obj._p_changed = 0 # trans. from changed to uptodate
                     obj._p_serial = serial
 
     def tpc_finish(self, transaction):




More information about the Zodb-checkins mailing list