RE: using cdb for 'update' without race condition?
"Dave Kitabjian" <[email protected]> Thu, 10 Apr 2008 14:46:16 -0400
| Newsgroups | gmane.comp.djb.cdb |
|---|---|
| Message-ID | <E388694238BBE5459F483F47306E4F100977663B@nce2k.ncdomain.netcarrier.com> |
Your concern seems to center around something you call "losing an update". What does that mean? Presumably, you're going to run your steps 1-2-3 periodically. If so, then any update that you "missed" this time around will show up the next.=20 Am I missing something? Dave -----Original Message----- From: Norman Ramsey [mailto:[email protected]]=20 Sent: Wednesday, April 09, 2008 10:21 PM To: [email protected] Subject: using cdb for 'update' without race condition? I'm interested in checking out cdb for a database that will be updated programmatically. Since the database is 'constant', 'update' is a bit of a contradiction in terms, but I believe the effect of an atomic update for a cdb database works like this: 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. 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. Can anyone comment on the proposal and analysis above? I'm particularly eager to know if I've made mistakes. I suspect this is an FAQ, but I cannot find a Web archive for this list, nor can I get the ezmlm index command to work (mail sent to cdb-index was rejected with a polite error message). Norman