Store unspecified scheme names in database as empty string, not null.
[cumulus.git] / lbs.py
diff --git a/lbs.py b/lbs.py
index 4224cf9..392bb04 100644 (file)
--- a/lbs.py
+++ b/lbs.py
@@ -541,6 +541,11 @@ class LocalDatabase:
                                            where expire_time < ?)""",
                     (last_snapshotid,))
 
+        # Remove sub-block signatures for deleted objects.
+        cur.execute("""delete from subblock_signatures
+                       where blockid not in
+                           (select blockid from block_index)""")
+
     # Segment cleaning.
     class SegmentInfo(Struct): pass
 
@@ -564,7 +569,8 @@ class LocalDatabase:
         cur = self.cursor()
         segments = []
         cur.execute("""select segmentid, used, size, mtime,
-                       julianday('now') - mtime as age from segment_info""")
+                       julianday('now') - mtime as age from segment_info
+                       where expire_time is null""")
         for row in cur:
             info = self.SegmentInfo()
             info.id = row[0]