
Hi Kazuhiko, https://jira.mariadb.org/browse/MDEV-36472 was finally filed on our side for this anomaly. I am afraid that the performance of purging committed transaction history was reduced due to the correctness fixes MDEV-26465, MDEV-30671 and MDEV-31355. Before those fixes, some history could have been removed prematurely, while it was possible for some older transaction to access the records. I suspect that some crashes on MVCC reads (MDEV-14407) had occurred exactly because some data had been purged before these bugs had been fixed. I can see two possible developments how we could improve this. The easier one would be to introduce a global Boolean variable that you could set to make the purge more aggressive. Old transactions would fail with an error. There is an InnoDB internal error code DB_MISSING_HISTORY, which currently should only be possible when the undo logs are corrupted in some way. We could start returning a higher level error, such as ER_CHECKREAD, which was recently enabled by the innodb_snapshot_isolation setting (MDEV-35124). This error will always result in the transaction being rolled back, just like a deadlock would. A more advanced solution would be to finally implement per-record transaction identifiers in secondary indexes (MDEV-17598). This should significantly speed up the purge operation in secondary indexes. Best regards, Marko