Re: [Exim] Updating CDB databases

Top Page
Delete this message
Reply to this message
Author: Richard Gilbert
Date:  
To: Suresh Ramasubramanian
CC: exim-users
Subject: Re: [Exim] Updating CDB databases
> > Our aliases database (and "inverse aliases" database used for address
> > rewriting) are in CDB files which are updated from a snapshot of a
> > MySQL database every 15 minutes. I am starting to see problems with
> > messages being rejected because [entries in] the CDB databases


Correction                          ^^^^^^^^^^^^


> > momentarily disappear at the time of the update. cdbmake updates the
> > database as an atomic operation but this is not sufficient to prevent
> > problems. I am trying to think of cunning ways to circumvent the
> > problem, which can cause a few unlucky users to have their messages
> > rejected, but before doing so I thought I would ask how other people
> > deal with this problem.
>
> Build the CDB elsewhere and use mv or rn to move / rename it to the
> location you want, either which is atomic.


I should have said that I have already tried this but I now see problems
which are of two types: I still see the problem of entries apparently
disappearing from the database but I also see errors caused by the file
not being found. The latter are actually an improvement because the
messages get retried.

Here are the relevant lines from mu Makefile:

        cdb_encode.pl aliases | $(CDBMAKE) tmp_aliases.cdb aliases.tmp
        cdb_encode.pl invaliases | $(CDBMAKE) tmp_invaliases.cdb invaliases.tmp
        mv invaliases.cdb invaliases.cdb.old
        mv tmp_invaliases.cdb invaliases.cdb
        mv aliases.cdb aliases.cdb.old
        mv tmp_aliases.cdb aliases.cdb


Moving the files to .old files was intended to allow any process which had
the file open to continue, but I don't know enough about the low-level
detail of how file handles mv commands and i-nodes behave.

but, e.g...

2004-02-09 10:00:51 system_aliases director: failed to open
/var/spool/exim/tables/aliases.cdb for cdb lookup: No such file or directory

TYIA

Richard
--
Richard Gilbert
Corporate Information and Computing Services
University of Sheffield, Sheffield, S10 2TN, UK
Phone: +44 114 222 3028 Fax: +44 114 222 3040