projects
/
cumulus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Place expired and repacked objects into segments based on database.
[cumulus.git]
/
schema.sql
diff --git
a/schema.sql
b/schema.sql
index
5017d9b
..
2cca99a
100644
(file)
--- a/
schema.sql
+++ b/
schema.sql
@@
-7,13
+7,16
@@
create table snapshots (
snapshotid integer primary key,
name text not null,
create table snapshots (
snapshotid integer primary key,
name text not null,
+ scheme text,
timestamp real
);
-- List of segments which have been created.
create table segments (
segmentid integer primary key,
timestamp real
);
-- List of segments which have been created.
create table segments (
segmentid integer primary key,
- segment text unique not null
+ segment text unique not null,
+ path text,
+ checksum text
);
-- Index of all blocks which have been stored in a snapshot, by checksum.
);
-- Index of all blocks which have been stored in a snapshot, by checksum.
@@
-41,7
+44,7
@@
create unique index snapshot_contents_unique
create view segment_info as select * from
(select segmentid, max(timestamp) as mtime,
sum(size) as size, count(*) as objects
create view segment_info as select * from
(select segmentid, max(timestamp) as mtime,
sum(size) as size, count(*) as objects
- from block_index
natural join segments
group by segmentid)
+ from block_index
join segments using (segmentid)
group by segmentid)
natural join
(select segmentid, sum(size) as used, count(*) as objects_used
from block_index where blockid in
natural join
(select segmentid, sum(size) as used, count(*) as objects_used
from block_index where blockid in
@@
-49,7
+52,7
@@
natural join
-- Ranking of segments to be cleaned, using a benefit function of
-- (fraction free space)*(age of youngest object).
-- Ranking of segments to be cleaned, using a benefit function of
-- (fraction free space)*(age of youngest object).
-create view cleaning_order as select *, (1-u)*age as benefit from
+create view cleaning_order as select *, (1-u)*age
/(u+0.1)
as benefit from
(select segmentid,
cast(used as real) / size as u, julianday('now') - mtime as age
from segment_info)
(select segmentid,
cast(used as real) / size as u, julianday('now') - mtime as age
from segment_info)