[Zope-Checkins] CVS: ZODB3/ZODB - DB.py:1.50.8.1

Jeremy Hylton jeremy at zope.com
Wed Sep 3 16:52:52 EDT 2003


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv2686/ZODB

Modified Files:
      Tag: ZODB3-3_2-branch
	DB.py 
Log Message:
Port Jim's remove-version-pool changes from Zope-2_7-branch.


=== ZODB3/ZODB/DB.py 1.50 => 1.50.8.1 ===
--- ZODB3/ZODB/DB.py:1.50	Wed Apr 23 16:05:51 2003
+++ ZODB3/ZODB/DB.py	Wed Sep  3 15:52:21 2003
@@ -136,12 +136,24 @@
                 am.closedConnection(connection)
             version=connection._version
             pools,pooll=self._pools
-            pool, allocated, pool_lock = pools[version]
+            try:
+                pool, allocated, pool_lock = pools[version]
+            except KeyError:
+                # No such version. We must have deleted the pool.
+                # Just let the connection go.
+
+                # We need to break circular refs to make it really go.
+                # XXX What objects are involved in the cycle?
+                connection.__dict__.clear()
+                
+                return
+                
             pool.append(connection)
             if len(pool)==1:
                 # Pool now usable again, unlock it.
                 pool_lock.release()
-        finally: self._r()
+        finally:
+            self._r()
 
     def _connectionMap(self, f):
         self._a()
@@ -384,7 +396,7 @@
                 return c
 
 
-            pools,pooll=self._pools
+            pools, pooll = self._pools
 
             # pools is a mapping object:
             #
@@ -472,6 +484,20 @@
             return c
 
         finally: self._r()
+
+    def removeVersionPool(self, version):
+        pools, pooll = self._pools
+        info = pools.get(version)
+        if info:
+            del pools[version]
+            pool, allocated, pool_lock = info
+            pooll.remove((pool, allocated))
+            try:
+                pool_lock.release()
+            except: # XXX Do we actually expect this to fail?
+                pass
+            del pool[:]
+            del allocated[:]
 
     def connectionDebugInfo(self):
         r=[]




More information about the Zope-Checkins mailing list