[Checkins] SVN: relstorage/trunk/relstorage/ Python (rather than SQL) implementation of graph traversal for garbage collection.

Shane Hathaway shane at hathawaymix.org
Wed Feb 2 09:30:46 EST 2011


Log message for revision 120050:
  Python (rather than SQL) implementation of graph traversal for garbage collection.
  

Changed:
  U   relstorage/trunk/relstorage/adapters/packundo.py
  U   relstorage/trunk/relstorage/options.py

-=-
Modified: relstorage/trunk/relstorage/adapters/packundo.py
===================================================================
--- relstorage/trunk/relstorage/adapters/packundo.py	2011-02-02 13:51:11 UTC (rev 120049)
+++ relstorage/trunk/relstorage/adapters/packundo.py	2011-02-02 14:30:46 UTC (rev 120050)
@@ -78,7 +78,7 @@
         log.info("pre_pack: downloading pack_object and object_ref.")
 
         # Download the list of root objects to keep from pack_object.
-        keep_set = IISet([0])  # set([oid])
+        keep_set = IISet()  # set([oid])
         stmt = """
         SELECT zoid
         FROM pack_object
@@ -100,19 +100,21 @@
         """
         self.runner.run_script_stmt(cursor, stmt)
         current_oid = None
-        current_refs = IISet()  # set([to_oid])
         for from_oid, to_oid in cursor:
             if current_oid is None:
                 current_oid = from_oid
+                current_refs = IISet()  # set([to_oid])
             elif current_oid != from_oid:
                 all_refs[current_oid] = current_refs
+                current_oid = from_oid
                 current_refs = IISet()
             current_refs.insert(to_oid)
         if current_oid is not None:
             all_refs[current_oid] = current_refs
 
-        # Traverse the object graph.  Add to keep_set all of the
-        # reachable OIDs.
+        # Traverse the object graph.  Add all of the reachable OIDs
+        # to keep_set.
+        log.info("pre_pack: traversing the object graph.")
         added_oids = IISet()
         added_oids.update(keep_set)
         pass_num = 0

Modified: relstorage/trunk/relstorage/options.py
===================================================================
--- relstorage/trunk/relstorage/options.py	2011-02-02 13:51:11 UTC (rev 120049)
+++ relstorage/trunk/relstorage/options.py	2011-02-02 14:30:46 UTC (rev 120050)
@@ -37,7 +37,7 @@
         self.replica_timeout = 600.0
         self.poll_interval = 0
         self.pack_gc = True
-        self.pack_gc_traversal = 'sql'
+        self.pack_gc_traversal = 'python'
         self.pack_dry_run = False
         self.pack_batch_timeout = 5.0
         self.pack_duty_cycle = 0.5



More information about the checkins mailing list