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

Jeremy Hylton cvs-admin at zope.org
Wed Nov 26 16:44:40 EST 2003


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

Modified Files:
      Tag: Zope-2_6-branch
	simul.py 
Log Message:
Assume that the 2Q cache is persistent.  Don't clear it on restart.


=== ZODB3/ZEO/simul.py 1.12.8.2.18.1 => 1.12.8.2.18.2 ===
--- ZODB3/ZEO/simul.py:1.12.8.2.18.1	Wed Nov 26 15:19:01 2003
+++ ZODB3/ZEO/simul.py	Wed Nov 26 16:44:39 2003
@@ -449,6 +449,20 @@
         self.total_evicts = 0
         self.a1out_limit = outlen
 
+        # An LRU queue of hot objects
+        self.am = Node2Q(None, None, am)
+        self.am.linkbefore(self.am)
+        # A FIFO queue of recently referenced objects.  It's purpose
+        # is to absorb references to objects that are accessed a few
+        # times in short order, then forgotten about.
+        self.a1in = Node2Q(None, None, a1in)
+        self.a1in.linkbefore(self.a1in)
+        # A FIFO queue of recently reference oids.
+        # This queue only stores the oids, not any data.  If we get a
+        # hit in this queue, promote the object to am.
+        self.a1out = Node2Q(None, None, a1out)
+        self.a1out.linkbefore(self.a1out)
+        
     def makespace(self, size):
         for space in 0, size:
             if self.enoughspace(size):
@@ -506,12 +520,14 @@
             self.am_size = self.am_size - node.size + size
             node.size = size
             if self.am_size > self.am_limit:
-                print "write exceeded limit", self.am_size - self.am_limit
+                pass
+##                print "write exceeded limit", self.am_size - self.am_limit
         else:
             self.a1in_size = self.a1in_size - node.size + size
             node.size = size
             if self.a1in_size > self.a1in_limit:
-                print "write exceeded limit", self.a1in_size - self.a1in_limit
+                pass
+##                print "write exceeded limit", self.a1in_size - self.a1in_limit
 
     def load(self, oid, size):
         node = self.cache.get(oid)
@@ -534,6 +550,7 @@
             node = Node2Q(oid, size, a1in)
             node.linkbefore(self.a1in)
             self.cache[oid] = node
+            self.a1in_size += node.size
 
     def inval(self, oid):
         # The original 2Q algorithm didn't have to deal with
@@ -564,20 +581,6 @@
         self.am_size = 0
         self.a1in_size = 0
         self.a1out_size = 0
-
-        # An LRU queue of hot objects
-        self.am = Node2Q(None, None, am)
-        self.am.linkbefore(self.am)
-        # A FIFO queue of recently referenced objects.  It's purpose
-        # is to absorb references to objects that are accessed a few
-        # times in short order, then forgotten about.
-        self.a1in = Node2Q(None, None, a1in)
-        self.a1in.linkbefore(self.a1in)
-        # A FIFO queue of recently reference oids.
-        # This queue only stores the oids, not any data.  If we get a
-        # hit in this queue, promote the object to am.
-        self.a1out = Node2Q(None, None, a1out)
-        self.a1out.linkbefore(self.a1out)
 
 class Node2Q(Node):
 




More information about the Zope-Checkins mailing list