Bug #115316 Undo tablespace is truncated to 16 MB instead of its initial size.
Submitted: 13 Jun 2024 11:47 Modified: 13 Jun 2024 12:21
Reporter: Fabio Fabio Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: truncate, undo

[13 Jun 2024 11:47] Fabio Fabio
Description:
The document at https://dev.mysql.com/doc/refman/8.0/en/innodb-undo-tablespaces.html says:

"After all rollback segments in the undo tablespace are freed, the truncate operation runs and truncates the undo tablespace to its initial size."

In fact, the undo tablespace is normally truncated to 16 MB instead of its initial size. Because new undo tablespace will be re-created after a truncate operation, and its initial size is normally reset to 16 MB, which is different from the INITIAL_SIZE actually seen in table informaiton_schema.files.

Refer to the function trx_undo_truncate_tablespace:

  auto n_pages = UNDO_INITIAL_SIZE_IN_PAGES;  // UNDO_INITIAL_SIZE is 16MB
  ...
  /* Create the new UNDO tablespace. */
  if (fil_ibd_create(new_space_id, marked_space->space_name(),
                     marked_space->file_name(), flags, n_pages) != DB_SUCCESS) {
    return false;
  }

How to repeat:
This is a documentation issue.

Suggested fix:
I think this description is more reasonable.

"After all rollback segments in the undo tablespace are freed, the truncate operation runs and truncates the undo tablespace to 16MB normally."
[13 Jun 2024 12:21] MySQL Verification Team
HI Mr. Fabio,

Thank you for your bug report.

After examining the code, we have to agree that this is truly a wrong description.

This is now a verified documentation bug.

Thank you.