Dynamically Changing innodb_lock_wait_timeout
The length of time a transaction waits for a resource, before giving up and rolling back the statement, is determined by the value of the configuration parameter innodb_lock_wait_timeout
. (In MariaDB 5.0.12 and earlier, the entire transaction was rolled back, not just the statement.) Your application can try the statement again (usually after waiting for a while), or roll back the entire transaction and restart.
The error returned when the timeout period is exceeded is:
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
In MariaDB 5.5 and higher, the configuration parameter innodb_lock_wait_timeout
can be set at runtime with the SET GLOBAL
or SET SESSION
statement. Changing the GLOBAL
setting requires the SUPER
privilege and affects the operation of all clients that subsequently connect. Any client can change the SESSION
setting for innodb_lock_wait_timeout
, which affects only that client.
In MariaDB 5.1 and earlier, the only way to set this parameter was in the MariaDB option file (my.cnf
or my.ini
), and changing it required shutting down and restarting the server.