Hi!

I have a rather large problem. I run a multi-process-robo-data-collector
wich are connected to a single database.
To make things faster, it runs on several machines leeching on the
processor-power that machines can spare.
The problem is to make them do diffrent things all the time!

This is a record:   id  ;  data  ;  more_data  ;  done (Y/N)


When I start the loop, I perform a simple query:  "SELECT id from users
where done = 'N' LIMIT 1" 
Then : "UPDATE users set done = 'Y' WHERE id = '$id'"  and $id is the id
collected from previous query.

Then some time goes (5-15 secs) and i: UPDATE users set data =
'blahblah',more_data = 'more blah' WHERE id = '$id'

On top of that, I insert more data into the table: "INSERT DELAYED INTO
users (id,done) VALUES('some_id','N')"

back to start of loop again...

The problem is to get the table locked so the other processes NEVER fetches
the same id and they tend to do 
that on the very short time that elapses between the first SELECT and
UPDATE query.


Regards 

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to