Percona-QA/pquery

How to deal with lock conflict properly?

raywill opened this issue · 2 comments

For example:

select for update would lock up several rows. This could block other threads writing on these rows.

maybe @RoelVdP can answer? I think it's a logic inside mysql library, nothing specific to pquery itself

@raywill good question. Most of the testing we do is single threaded. My general finding over the years is that 85-95% (leaning towards the higher end) of all issues can be found/reproduced using a single thread. Still, the question is valid for multi-threaded testing where locking happens. One idea, but more from a "workaround" perspective would be to - for example where mysqld locks up - grab a gdb snapshot of what's happening in server at that moment. You may also find https://github.com/yoshinorim/quickstack of interest. As for actually intelligently handling these locking situation, needs more thinking/research. From memory, mysql generally relies on developers retrying failed trx.