Hi

I have a number of clients connecting to a DB in order to take jobs off a 
queue, mark them active, then run them.  In pseudo code, each client executes 
the following sequence of queries:

a-- select test_id from tests where status=1 and priority < 11 order by 
priority
b-- update tests set status=2 where test_id = <result of query above>
< load,run test etc>
[ eg status==1 -> queued, status==2 -> active]
What happens in some cases is that tests can be marked active by more than one 
client.  I'm guessing what is happening (if we have two clients C1, C2 ) is 
the following sequence of events in the DBMS:

C1a
C2a
C1b
C2b

What's the best way to ensure that a single client executes both a and b 
atomically so that no other client can show up and execute an 'a' between 
another client's a and b ? 
Cheers
Tim

Never be afraid to tell anyone who you are
        --Anonymous

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to