[ZODB-Dev] Is there any convenient way to reduce the storage file size after delete something in database?

Vincent Pelletier vincent at nexedi.com
Tue Sep 27 03:54:20 EST 2011


Le mardi 27 septembre 2011 10:23:01, 刘一新 a écrit :
> But If I want to only remove some object in test.fs, I must do following:
>    1. zeopack the database
>    2. rm -f test.fs.old
> Am I right?

You are right.

> BTW, what does the zeopack exactly do? And when should I use it? I try to
> find some instructions on it but without success.

First, you need to know that FileStorage (what manages data.fs files) is an 
append-only mechanism, where every new transaction (object creation, 
modification...) is appended, and usually you see the result of all 
accumulated transactions.
Deletion is merely the modification of a container object so that it stops 
referencing part of its content. As such, it will be appended too.

Packing is the way to free file-system space  after deleting objects. It has 2 
phases/purposes:
- revision pruning: non-current (...at the time given for packing) object
  revisions are deleted
- garbage collection: unreachable objects are deleted
As you noticed, with FileStorage this actually happens by copying every kept 
objects and transactions to a new data.fs, and swapping it with original 
data.fs - which gets renamed as *.old.

Regards,
-- 
Vincent Pelletier
ERP5 - open source ERP/CRM for flexible enterprises


More information about the ZODB-Dev mailing list