# InnoDB Data Scrubbing

{% hint style="warning" %}
Most of the background and redo log scrubbing code has been removed in [MariaDB 10.5.2](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.5/10.5.2). See [MDEV-15528](https://jira.mariadb.org/browse/MDEV-15528) and [MDEV-21870](https://jira.mariadb.org/browse/MDEV-21870).
{% endhint %}

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.

Support for [InnoDB](https://mariadb.com/docs/server/server-usage/storage-engines/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](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables). Log scrubbing happens in a separate thread.

To configure scrubbing one can use the following variables:

|                                                                                                                                                                                 |           |                                                                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------- |
| [innodb-background-scrub-data-check-interval](https://mariadb.com/docs/server/server-usage/storage-engines/innodb-system-variables#innodb_background_scrub_data_check_interval) | Seconds   | Check at this intervall if tablespaces needs scrubbing. Deprecated and ignored.                 |
| [innodb-background-scrub-data-compressed](https://mariadb.com/docs/server/server-usage/storage-engines/innodb-system-variables#innodb_background_scrub_data_compressed)         | Boolean   | Enable scrubbing of compressed data by background threads. Deprecated and ignored.              |
| [innodb-background-scrub-data-interval](https://mariadb.com/docs/server/server-usage/storage-engines/innodb-system-variables#innodb_background_scrub_data_interval)             | Seconds   | Scrub spaces that were last scrubbed longer than this many seconds ago. Deprecated and ignored. |
| [innodb-background-scrub-data-uncompressed](https://mariadb.com/docs/server/server-usage/storage-engines/innodb-system-variables#innodb_background_scrub_data_uncompressed)     | Boolean   | Enable scrubbing of uncompressed data by background threads. Deprecated and ignored.            |
| [innodb-immediate-scrub-data-uncompressed](https://mariadb.com/docs/server/server-usage/storage-engines/innodb-system-variables#innodb_immediate_scrub_data_uncompressed)       | Boolean   | Enable scrubbing of uncompressed data.                                                          |
| [innodb-scrub-log](https://mariadb.com/docs/server/server-usage/storage-engines/innodb-system-variables#innodb_scrub_log)                                                       | Boolean   | Enable redo log scrubbing. Deprecated and ignored.                                              |
| [innodb-scrub-log-speed](https://mariadb.com/docs/server/server-usage/storage-engines/innodb-system-variables#innodb_scrub_log_speed)                                           | Bytes/sec | Redo log scrubbing speed in bytes/sec. Deprecated and ignored.                                  |

Redo log scrubbing did not fully work as intended, and was deprecated and ignored in [MariaDB 10.5.2](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.5/10.5.2) ([MDEV-21870](https://jira.mariadb.org/browse/MDEV-21870)). If old log contents should be kept secret, enabling [innodb\_encrypt\_log](https://mariadb.com/docs/server/server-usage/storage-engines/innodb-system-variables#innodb_encrypt_log) or setting a smaller [innodb\_log\_file\_size](https://mariadb.com/docs/server/server-usage/storage-engines/innodb-system-variables#innodb_log_file_size) could help.

The [Information Schema INNODB\_TABLESPACES\_SCRUBBING table](https://mariadb.com/docs/server/reference/system-tables/information-schema/information-schema-tables/information-schema-innodb-tables/information-schema-innodb_tablespaces_scrubbing-table) contains scrubbing information.

## Thanks

* Scrubbing was donated to the MariaDB project by Google.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-data-scrubbing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
