3

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?

hiway
  • 3,906
  • 10
  • 34
  • 57

1 Answers1

0

Actually there's no settings for transaction timeout, still wait_timeout or interactive_timeout applies. What --innodb_rollback_on_timeout affected is the behavior of rollback(whole transaction or statements in the transation).

Sherry
  • 189
  • 7