[Zope-Checkins] CVS: ZODB3/ZEO - simul.py:1.12.8.2.18.9

Jeremy Hylton cvs-admin at zope.org
Thu Dec 4 01:52:44 EST 2003


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv5054

Modified Files:
      Tag: Zope-2_6-branch
	simul.py 
Log Message:
Add a bunch of hacks to prevent ARC from getting hung or failing.

I need to think more carefully about why it's getting hung up like
this, but not tonight.  Just want to get some ballpark numbers before
turning in.


=== ZODB3/ZEO/simul.py 1.12.8.2.18.8 => 1.12.8.2.18.9 ===
--- ZODB3/ZEO/simul.py:1.12.8.2.18.8	Thu Dec  4 01:29:43 2003
+++ ZODB3/ZEO/simul.py	Thu Dec  4 01:52:43 2003
@@ -716,6 +716,8 @@
         self.total_evicts += 1
         if self.fifoT_size > self.p or (lruB and self.fifoT_size == self.p):
             node = self.fifoT.next
+            if node is self.fifoT:
+                return 0
             assert node is not self.fifoT, self.stats()
             node.linkbefore(self.fifoB)
             self.fifoT_len -= 1
@@ -724,6 +726,8 @@
             self.fifoB_size += node.size
         else:
             node = self.lruT.next
+            if node is self.lruT:
+                return 0
             assert node is not self.lruT, self.stats()
             node.linkbefore(self.lruB)
             self.lruT_len -= 1
@@ -763,7 +767,7 @@
             # If fifo is full, we'll need to evict something to make
             # room for it.
 
-            need = size
+            prev = need = size
             while need > 0:
                 if size + self.fifoT_size + self.fifoB_size >= self.cachelimit:
                     if need + self.fifoT_size >= self.cachelimit:
@@ -790,6 +794,8 @@
                                   + self.lruB_size)
                     if total_size >= self.cachelimit * 2:
                         node = self.lruB.next
+                        if node is self.lruB:
+                            break
                         assert node is not self.lruB
                         node.unlink()
                         del self.cache[node.oid]
@@ -799,6 +805,10 @@
                         need -= self.replace()
                     else:
                         break
+                if need == prev:
+                    # XXX hack, apparently we can't get rid of anything else
+                    break
+                prev = need
 
             node = Node2Q(oid, size)
             node.linkbefore(self.fifoT)
@@ -845,7 +855,10 @@
                 need = node.size
                 if self.lruT_size + self.fifoT_size + need > self.cachelimit:
                     while need > 0:
-                        need -= self.replace()
+                        r = self.replace()
+                        if not r:
+                            break
+                        need -= r
                         
             elif node.kind is lruB:
                 node.linkbefore(self.lruT)
@@ -864,7 +877,10 @@
                 need = node.size
                 if self.lruT_size + self.fifoT_size + need > self.cachelimit:
                     while need > 0:
-                        need -= self.replace(lruB=True)
+                        r = self.replace(lruB=True)
+                        if not r:
+                            break
+                        need -= r
                 
     def inval(self, oid):
         pass




More information about the Zope-Checkins mailing list