[ZODB-Dev] Packing to 0 days?
Toby Dickenson
tdickenson at geminidataloggers.com
Thu Oct 9 10:52:36 EDT 2003
On Thursday 09 October 2003 15:15, Chris Withers wrote:
> Shane Hathaway wrote:
> > One more thing: when you pack, do you pack to 0 days? You probably
> > should.
>
> My memories has something in it about this being "bad"...
>
> Can anyone think why that would be the case?
In FileStorage, this will discard any object that is not referenced by the
root object, as seen by the state on disk.
There are some corner cases where this type of unreachable object may become
reachable again, if there is a reference to it in memory that gets written in
a subsequent transaction. If you happen to pack during the period where it is
unreachable then the subsequent transaction will write a dangling reference.
Dangling references will always raise a POSKeyError when accessed.
More details here:
http://mail.zope.org/pipermail/zodb-dev/2002-May/002602.html
BDBStorage reduces the chances of hitting this by not discarding objects
written in sufficiently recent transactions. '0 days' doesnt quite mean zero
time in BDBStorage
DirectoryStorage has this same protection, plus it has code to raise an
exception when committing a transaction that will write a dangling reference.
You will get a hard error instead of silently corrupting your storage.
--
Toby Dickenson
More information about the ZODB-Dev
mailing list