[Zodb-checkins] CVS: Zope/lib/python/ZODB - DB.py:1.43.6.4

Jim Fulton jim at zope.com
Tue Jun 24 17:16:24 EDT 2003


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

Modified Files:
      Tag: Zope-2_6-branch
	DB.py 
Log Message:
Added a database removeVersionPool to remove a version pool.


=== Zope/lib/python/ZODB/DB.py 1.43.6.3 => 1.43.6.4 ===
--- Zope/lib/python/ZODB/DB.py:1.43.6.3	Wed Apr 30 17:20:36 2003
+++ Zope/lib/python/ZODB/DB.py	Tue Jun 24 16:15:53 2003
@@ -136,12 +136,23 @@
                 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:
+                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 +395,7 @@
                 return c
 
 
-            pools,pooll=self._pools
+            pools, pooll = self._pools
 
             # pools is a mapping object:
             #
@@ -472,6 +483,19 @@
             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: pass
+            del pool[:]
+            del allocated[:]
+            6
 
     def connectionDebugInfo(self):
         r=[]




More information about the Zodb-checkins mailing list