This is a read-only copy of the MariaDB Knowledgebase generated on 2024-12-18. For the latest, interactive version please visit https://mariadb.com/kb/.

InnoDB Data Scrubbing

Note that most of the background and redo log scrubbing code has been removed in MariaDB 10.5.2. See MDEV-15528 and MDEV-21870.

Sometimes there is a requirement that when some data is deleted, it is really gone. This might be the case when one stores user's personal information or some other sensitive data. Normally though, when a row is deleted, the space is only marked as free on the page. It may eventually be overwritten, but there is no guarantee when that will happen. A copy of the deleted rows may also be present in the log files.

MariaDB 10.1.3 introduced support for InnoDB data scrubbing. Background threads periodically scan tablespaces and logs and remove all data that should be deleted. The number of background threads for tablespace scans is set by innodb-encryption-threads. Log scrubbing happens in a separate thread.

To configure scrubbing one can use the following variables:

innodb-background-scrub-data-check-intervalSecondsCheck at this intervall if tablespaces needs scrubbing. Deprecated and ignored from MariaDB 10.5.2.
innodb-background-scrub-data-compressedBooleanEnable scrubbing of compressed data by background threads. Deprecated and ignored from MariaDB 10.5.2.
innodb-background-scrub-data-intervalSecondsScrub spaces that were last scrubbed longer than this many seconds ago. Deprecated and ignored from MariaDB 10.5.2.
innodb-background-scrub-data-uncompressedBooleanEnable scrubbing of uncompressed data by background threads. Deprecated and ignored from MariaDB 10.5.2.
innodb-immediate-scrub-data-uncompressedBooleanEnable scrubbing of uncompressed data
innodb-scrub-logBooleanEnable redo log scrubbing. Deprecated and ignored from MariaDB 10.5.2.
innodb-scrub-log-speedBytes/secRedo log scrubbing speed in bytes/sec. Deprecated and ignored from MariaDB 10.5.2.

Redo log scrubbing did not fully work as intended, and was deprecated and ignored in MariaDB 10.5.2 (MDEV-21870). If old log contents should be kept secret, then enabling innodb_encrypt_log or setting a smaller innodb_log_file_size could help.

The Information Schema INNODB_TABLESPACES_SCRUBBING table contains scrubbing information.

Thanks

  • Scrubbing was donated to the MariaDB project by Google.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.