The current (trunk) Freenet has a very simple garbage collection mechanism for 
persistent buckets (temp files which persist across restarts):
We list them on startup, and then as each insert registers itself, it removes 
the buckets it is responsible for from the list. Any that remain after all 
inserts have started are deleted.

This is not (directly) feasible on the db4o branch, and in any case can cause 
significant delays to startup, OOMs in some cases, and so on. So we should 
implement a progressive mark-sweep:
- We have a global generation counter, incremented when we start a mark/sweep.
- Persistent buckets have a generation counter too.
- This is set to the current mark-sweep generation when a bucket is created.
- Mark/sweep visits every request, insert, etc, and updates the generation 
counter for each bucket.
- The mark/sweep can happen incrementally: it can be interspersed with normal 
database jobs, e.g. processing one request and then letting a normal database 
job run, and then processing the next request. If these normal database jobs 
create buckets, they are automatically marked with the current generation, so 
they will be preserved.
- When the generation is complete, we go through the buckets and delete (and 
shout about, since this indicates a bug) anything which doesn't have the 
current generation set. This can also be incremental if necessary.

This can be implemented after the db4o branch is merged.

Any issues with the above?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20090401/bea8d1ca/attachment.pgp>

Reply via email to