Bug #69440 Documented minimal value of myisam_sort_buffer_size is wrong
Submitted: 11 Jun 2013 9:47 Modified: 12 Jun 2013 14:23
Reporter: tsubasa tanaka (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.1.70, 5.5.32, 5.6.12, 5.7.1 OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[11 Jun 2013 9:47] tsubasa tanaka
Description:
The minimal value of myisam_sort_buffer_size is described 4 in docs.
But actually, its lower limit is setted 4096.

http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_myisam_sort_buf...
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_myisam_sort_buf...
http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_myisam_sort_buf...

MySQL 5.1.70

in sql/mysqld.cc
  6859   {"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE,
  6860    "The buffer that is allocated when sorting the index when doing a REPAIR "
  6861    "or when creating indexes with CREATE INDEX or ALTER TABLE.",
  6862    &global_system_variables.myisam_sort_buff_size,
  6863    &max_system_variables.myisam_sort_buff_size, 0,
  6864    GET_ULONG, REQUIRED_ARG, 8192 * 1024, 4096, ~0ULL, 0, 1, 0},

MySQL 5.5.32

in storage/myisam/ha_myisam.cc
  85 static MYSQL_THDVAR_ULONGLONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG,
  86   "The buffer that is allocated when sorting the index when doing "
  87   "a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE", NULL, NULL,
  88   8192 * 1024, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), SIZE_T_MAX, 1);

in storage/myisam/myisamdef.h
 669 #define MIN_SORT_BUFFER         (4096-MALLOC_OVERHEAD)

MySQL 5.6.12

in storage/myisam/ha_myisam.cc
  86 static MYSQL_THDVAR_ULONGLONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG,
  87   "The buffer that is allocated when sorting the index when doing "
  88   "a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE", NULL, NULL,
  89   8192 * 1024, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), SIZE_T_MAX, 1);

in storage/myisam/myisamdef.h
 675 #define MIN_SORT_BUFFER         (4096-MALLOC_OVERHEAD)

How to repeat:
Set --myisam-sort-buffer-size=4 and run mysqld, you can get as following in your error-log.

130611 18:44:41 [Warning] option 'myisam-sort-buffer-size': unsigned value 4 adjusted to 4096

Suggested fix:
Please fix the doc.
[11 Jun 2013 10:20] MySQL Verification Team
Hello tsubasa,

Thank you for the report.
Verified as described.

Thanks,
Umesh
[12 Jun 2013 7:40] tsubasa tanaka
5.7.1-m11 too.

http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_myisam_sort_buf...

in mysql-5.7.1-m11/storage/myisam/ha_myisam.cc

  87 static MYSQL_THDVAR_ULONGLONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG,
  88   "The buffer that is allocated when sorting the index when doing "
  89   "a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE", NULL, NULL,
  90   8192 * 1024, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), SIZE_T_MAX, 1);

in mysql-5.7.1-m11/storage/myisam/myisamdef.h

 675 #define MIN_SORT_BUFFER         (4096-MALLOC_OVERHEAD)

2013-06-12 16:40:03 23664 [Warning] option 'myisam-sort-buffer-size': unsigned value 4 adjusted to 4096
[12 Jun 2013 14:23] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.