Data at rest encryption. MariaDB calls the get_latest_version() of the *_key_management plugins millions of times if innodb_encryption_threads>1 during data scrub.
Tested with file_key_management plugin, but it should not matter.
The issue can be seen at each background data scrub, so for testing purposes I have set the interval to 60 seconds:
When using innodb_encryption_threads>1 the function get_latest_version() of the plugin is called millions of times, also cpu load raises considerably.
Using innodb_encryption_threads=1 there is no such issue.