In theory, if I had two programs perform the same query at the exact same time: ($d = daemon PID)
UPDATE table SET daemon=$d WHERE daemon IS NULL LIMIT 1
Is there any chance they could hit the same record? I am using this to do job caching and execution. The damon field is null when inserted by the client and I have 4 backend processes to handle the actual jobs by first "claiming" the job entry with the first update statement and then doing:
SELECT * FROM table WHERE daemon=$d
to retrieve the entry. I just want to make sure that there is no way that any job could be processed more than once...
UPDATE table SET daemon=$d WHERE daemon IS NULL LIMIT 1
Is there any chance they could hit the same record? I am using this to do job caching and execution. The damon field is null when inserted by the client and I have 4 backend processes to handle the actual jobs by first "claiming" the job entry with the first update statement and then doing:
SELECT * FROM table WHERE daemon=$d
to retrieve the entry. I just want to make sure that there is no way that any job could be processed more than once...