Re: [exim] exim_tidydb doesn't make databases smaller

Top Pagina
Delete this message
Reply to this message
Auteur: Arkadiusz Miśkiewicz
Datum:  
Aan: exim-users
Onderwerp: Re: [exim] exim_tidydb doesn't make databases smaller
On Friday 23 of November 2012, Graeme Fowler wrote:
> On Fri, 2012-11-23 at 13:32 +0100, Arkadiusz Miśkiewicz wrote:
> > Shouldn't exim_tidydb make databases physically smaller?
>
> You'd like to think so, wouldn't you? However for reasons which are
> historical but mostly related to performance, Exim prefers to use the
> Berkeley DB library for its databases. These are "grow only" files -
> data is appended to them by allocating new leaves or pages in the file.


Well,

There is compact method + DB_FREE_SPACE that can do some freeing.
http://docs.oracle.com/cd/E17276_01/html/api_reference/C/dbcompact.html

>
> When data is removed, the leaves or pages may be re-used if they are
> empty but they are never deleted.
>
> The recommendation from the developers has always been to dump the DB
> and create a new one if the size is too big. In Exim's case, most of the
> time simply deleting it will suffice - they're designed to hold
> transient data such as retry information which will be regenerated after
> deletion.


Ok. Doing such daily cron job now

        [...]
        /usr/bin/exim_tidydb $t $SPOOLDIR $db > /dev/null
        toobig=$(/usr/bin/find $SPOOLDIR/db/$db -size +300M)
        if [ -n "$toobig" ]; then
                /usr/bin/exim_dumpdb $SPOOLDIR $db | /usr/bin/exim_dbmbuild -nowarn - $SPOOLDIR/db/$db.new > /dev/null
                chown exim:exim $SPOOLDIR/db/$db.new
                chmod 640 $SPOOLDIR/db/$db.new
                mv $SPOOLDIR/db/$db.new $SPOOLDIR/db/$db
        fi


> Graeme



--
Arkadiusz Miśkiewicz, arekm / maven.pl