gc and inventory db

Gavin Carr gavin at openfusion.com.au
Thu Jan 21 15:36:57 UTC 2010


On Sun, Jan 17, 2010 at 05:22:09PM +0000, Gavin Carr wrote:
> On Sun, Jan 17, 2010 at 10:12:17AM +0100, Kostas Chatzikokolakis wrote:
> > Chris Anderson wrote:
> > > i just noticed that gc doesn't seem to be updating the inventory db when
> > > it removes a stale chunk. is this behavior intentional?
> > 
> > The only reason I can guess is that all the commands of brackup-target
> > modify only the target, not the local machine. Still, I would prefer gc
> > to update the inventory db.
> 
> Yeah me too - I consider it a bug. Bug reports 
> (http://code.google.com/p/brackup/issues/list) and/or patches welcome.

Had a quick look at this, and it's a bit tricky to fix. It's conceptually
straightforward: in Target::gc when we're deleting @orphaned chunks from 
the target, also delete the corresponding entries in the inventory_db.

The only tricky part is that the @orphaned_chunks are the stored chunk
hashes, which are used as (part of) the inventory_db *values*, not the 
keys. (And we can't derive the keys because those mappings were in 
metafiles we've already pruned.) 

So I think we have to add something like a delete_values_beginning_with() 
method to the Dictionary classes under the InventoryDatabase, which seems 
a bit ugly.

Any thoughts?

Cheers,
Gavin



More information about the brackup mailing list