My question is similar to this questionMySQL rollback on transaction with lost/disconnected connection ,but it was 5 years ago.
If a client(like jdbc or something else) lock one row in table, execute some statements then network is down, so mysql would never receive commit
or rollback
command from client, does mysql support to rollback this transaction(unlock row) automatically?
I refer innodb_rollback_on_timeout
it says If --innodb_rollback_on_timeout is specified, a transaction timeout causes InnoDB to abort and roll back the entire transaction
, but how long is the transaction timeout
and where to set it?
The accepted answer in similar question is to use wait_timeout
, if wait_timeout
is set to a small number like 10 seconds, so the idle connections in pool(if used) need to test connection every 10 seconds before they are disconnected by mysql sever, is the cost too high? or is there other ways(configuration will be best) to solve my question?