Skip to content

Commit

Permalink
Don't bother informing user when gc takes <= 1s
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed May 28, 2010
1 parent 83de1af commit a716cb7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dedupfs.py
Expand Up @@ -1004,17 +1004,23 @@ def __collect_garbage(self): # {{{3

sub_start_time = time.time()
self.conn.execute('DELETE FROM inodes WHERE nlinks = 0')
self.logger.info("Cleaned up unused inodes in %s.", format_timespan(time.time() - sub_start_time))
elapsed_time = time.time() - sub_start_time
if elapsed_time > 1:
self.logger.info("Cleaned up unused inodes in %s.", format_timespan(elapsed_time))

sub_start_time = time.time()
self.conn.execute('DELETE FROM "index" WHERE inode NOT IN (SELECT inode FROM inodes)')
self.logger.info("Cleaned up unused index entries in %s.", format_timespan(time.time() - sub_start_time))
elapsed_time = time.time() - sub_start_time
if elapsed_time > 1:
self.logger.info("Cleaned up unused index entries in %s.", format_timespan(elapsed_time))

sub_start_time = time.time()
for row in self.conn.execute('SELECT hash FROM hashes WHERE id NOT IN (SELECT hash_id FROM "index")'):
del self.blocks[row[0]]
self.conn.execute('DELETE FROM hashes WHERE id NOT IN (SELECT hash_id FROM "index")')
self.logger.info("Cleaned up unused data blocks in %s.", format_timespan(time.time() - sub_start_time))
elapsed_time = time.time() - sub_start_time
if elapsed_time > 1:
self.logger.info("Cleaned up unused data blocks in %s.", format_timespan(time.time() - sub_start_time))

elapsed_time = time.time() - start_time
self.logger.info("Finished garbage collection in %s.", format_timespan(elapsed_time))
Expand Down

0 comments on commit a716cb7

Please sign in to comment.