> That shouldn't happen, since get_lock() will only succeed for one mysql
> connection at a time.
I figured it out.
Because there was an order by clause, the get_lock function was being
called for each row in the result set, and since each call to get_lock
releases any previous locks you had, mySQL was effectively locking and
then immediately unlocking (during the sort) each row in the result set.
I wound up moving the get_lock call into a second query, like this:
set i = 0;
select * from foo order by blah limit i, 1;
select get_lock(blah, 0);
and if that returns 0, do the processing, otherwise do:
i = i + 1; continue;
and that seems to be working like a charm now.
Thanks for your help!