On Mon, 2009-04-13 at 09:36 -0400, Joly, Robert (CAR:9D30) wrote: > > To fix this, I've written a patch that generates the > > temporary file name using mktemp(). This ensures that two > > process that try to write the XML file at the same time will > > use different temporary file names. Of course, one of those > > files (the one that is renamed last) will become the new XML > > file, but that is OK. > > Interesting. Does it mean that the second process to perform the rename > may overwrite (lose) the changes made by the first?
Depending on race conditions, various things can happen. But the XML file that remains afterward is the version that was written by one of the processes. And since the processes all see consistent versions of the IMDB and they lock the table for the duration of writing their new XML files, each written version of the XML file is a correct representation of the IMDB table at some particular moment. So it is possible that process A starts writing its file before process B starts writing its file, but that process A's version is the one the ultimately remains. That would leave the final XML file a short time "older" than the XML file that process B wrote, but it would be the correct contents for that earlier instant. Since we only write the XML file 20 seconds after the IMDB has been changed, we presumably can tolerate this situation. Dale _______________________________________________ sipx-dev mailing list [email protected] List Archive: http://list.sipfoundry.org/archive/sipx-dev Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev
