From 5b346a4689ac2c8458e30fd8752abd6e2f207c56 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Wed, 13 Feb 2008 14:27:52 -0800 Subject: [PATCH] Do not attempt to clean the same segment multiple times. --- contrib/upgrade0.6-localdb.sql | 4 ++-- lbs.py | 3 ++- schema.sql | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/contrib/upgrade0.6-localdb.sql b/contrib/upgrade0.6-localdb.sql index ce8797c..49fc1aa 100644 --- a/contrib/upgrade0.6-localdb.sql +++ b/contrib/upgrade0.6-localdb.sql @@ -68,8 +68,8 @@ drop view cleaning_order; drop view segment_info; create view segment_info as -select segmentid, mtime, size, cast(size * utilization as integer) as used, - utilization +select segmentid, mtime, size, expire_time, + cast(size * utilization as integer) as used, utilization from segments join (select segmentid, max(utilization) as utilization from segments_used group by segmentid) diff --git a/lbs.py b/lbs.py index 4224cf9..c2fd75b 100644 --- a/lbs.py +++ b/lbs.py @@ -564,7 +564,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] diff --git a/schema.sql b/schema.sql index f406d91..850e6a9 100644 --- a/schema.sql +++ b/schema.sql @@ -47,8 +47,8 @@ create unique index segments_used_index -- Overall estimate of segment utilization, for all snapshots combined. create view segment_info as -select segmentid, mtime, size, cast(size * utilization as integer) as used, - utilization +select segmentid, mtime, size, expire_time, + cast(size * utilization as integer) as used, utilization from segments join (select segmentid, max(utilization) as utilization from segments_used group by segmentid) -- 2.20.1