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

Jim Fulton jim at zope.com
Tue Jun 24 18:30:25 EDT 2003


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

Modified Files:
	DB.py 
Log Message:
Added a database removeVersionPool method to remove a version pool.


=== Zope/lib/python/ZODB/DB.py 1.50 => 1.51 ===
--- Zope/lib/python/ZODB/DB.py:1.50	Wed Apr 23 16:05:51 2003
+++ Zope/lib/python/ZODB/DB.py	Tue Jun 24 17:29:54 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