Re: using cdb for 'update' without race condition?
[email protected] (Paul Jarc) Thu, 10 Apr 2008 14:27:48 -0400
| Newsgroups | gmane.comp.djb.cdb |
|---|---|
| Organization | What did you have in mind? A short, blunt, human pyramid? |
| Message-ID | <[email protected]> |
Norman Ramsey <[email protected]> wrote: > 1. My app reads a database and extracts all the key-value pairs. > > 2. My app produces a new set of key-value pairs. > > 3. I atomically make a new database. I cannot do this through a C > API but only via the cdbmake program. Atomicity is guaranteed by > the way cdbmake uses the filesystem. Mostly correct. skalibs provices a C API for updates: http://www.skarnet.org/software/skalibs/ > It appears to me that if I want to avoid losing an update via race > conditions that my cdb file needs to be protected by some kind of > lock, and it's up to my app to use liblockfile or something similar. Yes, almost - since the original cdb file will be deleted during the update, it's not a good choice of lock file. You want to lock a different file which will remain in place. > I cannot find a Web archive for this list http://news.gmane.org/gmane.comp.djb.cdb paul