X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=python%2Fcumulus%2F__init__.py;h=8d57c212b644da32d7b2148312f5647e419abdf6;hb=09a8c1a81f29abc0cb1aceedf6c6363a67d6cd81;hp=10f0544189407e7fe31c1b4abf7b6c7fc1534adb;hpb=c343597dac79f9edc63d95d881625a317fadb1d9;p=cumulus.git diff --git a/python/cumulus/__init__.py b/python/cumulus/__init__.py index 10f0544..8d57c21 100644 --- a/python/cumulus/__init__.py +++ b/python/cumulus/__init__.py @@ -31,10 +31,10 @@ import hashlib import itertools import os import re +import sqlite3 import tarfile import tempfile import thread -from pysqlite2 import dbapi2 as sqlite3 import cumulus.store import cumulus.store.file @@ -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