From 5de8b48a12b5698dcc7a66ee459c2dca04a81b74 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Mon, 18 Mar 2013 10:21:14 -0700 Subject: [PATCH] Reworking cleanup. --- python/cumulus/__init__.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/python/cumulus/__init__.py b/python/cumulus/__init__.py index 10f0544..e8fc538 100644 --- a/python/cumulus/__init__.py +++ b/python/cumulus/__init__.py @@ -729,16 +729,15 @@ class LocalDatabase: """ cur = self.cursor() - # Delete entries in the segments_used table which are for non-existent - # snapshots. - cur.execute("""delete from segments_used + # Delete entries in the segment_utilization table which are for + # non-existent snapshots. + cur.execute("""delete from segment_utilization where snapshotid not in (select snapshotid from snapshots)""") - # Find segments which contain no objects used by any current snapshots, - # and delete them from the segment table. + # Delete segments not referenced by any current snapshots. cur.execute("""delete from segments where segmentid not in - (select segmentid from segments_used)""") + (select segmentid from segment_utilization)""") # Delete dangling objects in the block_index table. cur.execute("""delete from block_index -- 2.20.1