mariadb innodb_snapshot_isolation=1 causes "Record has changed since last read in table" errors

Xon

Well-known member
Affected version
2.3.7
The default for innodb_snapshot_isolation has changed to default on from MariaDB 11.6.2 which changes transaction behavior.

This can causes errors such as:
Code:
XF\Db\Exception: MySQL query error [1020]: Record has changed since last read in table 'xf_user' src/XF/Db/AbstractStatement.php:230
Code:
XF\Db\Exception: MySQL query error [1020]: Record has changed since last read in table 'xf_data_registry' src/XF/Db/AbstractStatement.php:230

I can't actually see the change in major version notes, only in the 11.6.2/11.7.1 point release notes. So it wasn't documented well despite being a major change in transaction handling :(
 
Last edited:
At a minimum, this error should be translated into a \XF\Db\DeadlockException

To be honest XF\Db::getException's switch statement should just be a bunch of ::class references instead of magic string changes. It would allow IDE tools which find this stuff much easier.
 
Back
Top Bottom