On Mon, 2004-10-18 at 12:27 +1000, Michael Kraus wrote: > Err, how is there a race condition? (Is there something I'm missing?)
Yes. processes can die and be spawned again very quickly. The granularity of your timestamp must be > the maximum time to spawn a process that was inserting that row. pids are not unique - they are reused, and timestamps just narrow the race, they don't eliminate it. To eliminate a race condition, you usually need an atomic operation of some sort. (A la unique row id's as already discussed by other contributors to this thread). > >From my reasoning - every process running at a particular point in time > has a unique process ID (i.e. no two processes running at the same time > will have the same PID), therefore a time/date stamp coupled with a PID > gives a unique identifier. datetime stamp != point in time. multiple machines being introduced would also break this assumption. > (For convenience and storage sake, a separate > primary key is used as well, but as that is created by the database > system itself, we don't know what that is at time of insertion.) Well, you do - see the other responses again. Rob -- GPG key available at: <http://www.robertcollins.net/keys.txt>.
signature.asc
Description: This is a digitally signed message part
-- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
