Bug #120400 Docs for innodb_sort_buffer_size are wrong or confusing
Submitted: 4 May 17:19 Modified: 4 May 17:46
Reporter: Mark Callaghan Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: stora

[4 May 17:19] Mark Callaghan
Description:
The docs describe this as something that determines the size of a file. Based on the name I assume it is the max memory per sort buffer. Perhaps this is a doc bug, perhaps this variable is used in multiple ways that I just don't understand.

The docs for innodb_sort_buffer_size here:
https://dev.mysql.com/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_sort_buffer_s...

... are:
This variable defines the amount by which the temporary log file is extended when recording concurrent DML during an online DDL operation, and the size of the temporary log file read buffer and write buffer.
For more information, see Section 17.12.3, “Online DDL Space Requirements”.

And then section 17.12.3 states:
The temporary log file is extended as required by the value of innodb_sort_buffer_size up to a maximum 
---
The innodb_sort_buffer_size variable also defines the size of the temporary log file read buffer and write buffer.

Search the code for usage of srv_sort_buf_size, most are in row0log.cc
https://github.com/mysql/mysql-server/blob/447eb26e094b444a88c532028647e48228c3c04f/storag...

How to repeat:
Read the docs and the source code.
[4 May 17:46] Mark Callaghan
There might be 3 things to fix:
1) I assume this still controls the max memory allocation for a sort.
2) I assume this isn't just for online DDL, it is also for non-online DDL
3) I don't get the part about temporary log files

Related to this is https://bugs.mysql.com/bug.php?id=100549 where InnoDB does 3 allocations per create index, where only one should be needed.