Suppose some user issued 'select ... for update', then
went for coffee-break (to think hard on what he
really wants to update in that row). Another client
tries to update the same row and I don't want him to
wait, just immediately return an error, so he could
do some other useful task meanwhile. I haven't found
any no_wait option for locks in the manual :(.
There's a variable innodb_lock_wait_timeout, though, but
unfortunately I can't assign 0 to it (min. value is 1).
Still, 1 second time-out can be bearable (although I'd
appreciate a way to reduce it to zero) but what disturbs
me is that I've read in the manual that deadlock-removing
algorithm aborts transaction which it thinks is most suitable
for aborting (not last-in-first-aborted). Since time-out
feature has something to do with deadlocks can I be
absolutely sure that WAITING transaction will be aborted
and not that which issued the lock?
And also it would be fine to have non-destructive means
to determine whether some row has been locked so I may
just skip (postpone) some updates without rollback
of whole transaction. Is it possible?