why unix | RBL service | netrs | please | ripcalc | linescroll | pwtool
hosted services

hosted services

rewritemaps and sdbm atomicness

For an overview of rewritemaps, please see rewritemaps and mod_rewrite. This page describes the issues around atomicness with SDBM files.

The issue, SDBM requires two files to function, the .dir and the `.pag files. These are relative to each other and must be kept in sync.

If your web server is receiving a lot of traffic then you will have issues if you rebuild the files in place. With a .txt map, it is simple to edit the file elsewhere and move it into place, since the move is an inode update, rather than a copy, the operation is safe. However, how can you move two files at the same time, safely, even though they are relatively quick, if your webserver is suffering from high IO, then it may not be as immediate as you think.

The only safe way that I have found is to update the web server configuration to reference a new set of sdbm files /after/ you have rebuild it in place then send the server a USR1 signal.

There is a hidden benefit to this, you'll get to keep prior versions of the database. Beware though, if you want to delete the old versions, besure that all apache's running that were started prior to the config reload have finished before you prune your old SDBM files.