Re: [Exim] Re: Persistent DB connections to MySQL database

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Richard Gilbert
Date:  
À: Philip Hazel
CC: exim-users
Sujet: Re: [Exim] Re: Persistent DB connections to MySQL database
> > > fly. What I would like to know is whether it would be safe to update the
> > > NDBM database used by Exim directly or whether I would need to lock it.
> >
> > - create it under a temporary name
> > - mv it into place ("mv" uses rename(2) which is guaranteed atomic).
>
> The problem with NDBM is that it uses *two* files, thus making it
> impossible to do an atomic rename. Well, not impossible, just messier.
> What you need to do is to put the two files into a directory, and rename
> the directory.


Thank you for your prompt reply, as ever. However, what I meant by update
was writing to the NDBM file directly. I was thinking of using a Perl
script which used tie, e.g.

use NDBM_File;
tie(%aliases, 'NDBM_File', 'aliases', 2, 0);
:
:
$aliases{$key} = $value;
:
:
untie %aliases;

(I know that the keys and values need to be null-terminated.)

Thank you again.

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