Bug #1987 myisam_max_sort_file_size is not properly handled
Submitted: 1 Dec 2003 3:30 Modified: 1 Dec 2003 8:08
Reporter: Masaki Fujimoto Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.16 OS:Linux (Debian GNU LInux (Woody))
Assigned to: CPU Architecture:Any

[1 Dec 2003 3:30] Masaki Fujimoto
Description:
I've found the following ChangeLog Entry at http://www.mysql.com/documentation/mysql/bychapter/manual_News.html#News-4.0.3:

* The startup parameters myisam_max_sort_file_size and myisam_max_extra_sort_file_size are now given in bytes, not megabytes.

and it seems that myisam_max_sort_file_size is not handled properly (specified values are implicitly changed or ignored).

IMHO the option entry in mysqld.cc is the cause of problem (it still handles myisam_max_sort_file_size as Mega Bytes parameter). In line 3947, block_size is still specified as 1024*1024.

mysql-4.0.16/sql/mysqld.cc:
   3942   {"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
   3943    "Don't use the fast sort index method to created index if the temporary file would get bigger than this!",
   3944    (gptr*) &global_system_variables.myisam_max_sort_file_size,
   3945    (gptr*) &max_system_variables.myisam_max_sort_file_size, 0,
   3946    GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE,
>  3947    0, 1024*1024, 0},

Please see 'How to repeat' for detail.

How to repeat:
mysql> SET GLOBAL myisam_max_sort_file_size=1;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW GLOBAL VARIABLES LIKE 'myisam_max_%';
+---------------------------------+-----------+
| Variable_name                   | Value     |
+---------------------------------+-----------+
| myisam_max_extra_sort_file_size | 268435456 |
| myisam_max_sort_file_size       | 0         |
+---------------------------------+-----------+
2 rows in set (0.00 sec)

Suggested fix:
$ diff -u mysqld.cc.bak mysqld.cc
--- mysqld.cc.bak       Mon Dec  1 20:28:12 2003
+++ mysqld.cc   Mon Dec  1 20:28:24 2003
@@ -3944,7 +3944,7 @@
    (gptr*) &global_system_variables.myisam_max_sort_file_size,
    (gptr*) &max_system_variables.myisam_max_sort_file_size, 0,
    GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE,
-   0, 1024*1024, 0},
+   0, 1, 0},
   {"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS,
    "Number of threads to use when repairing MyISAM tables. The value of 1 disables parallel repair.",
    (gptr*) &global_system_variables.myisam_repair_threads,
[1 Dec 2003 7:47] Dean Ellis
This seems to be handled appropriately (or at least consistently).  Per the block_size, values will fall along one megabyte boundaries (rounded down).  So, this would not appear to be a bug.

Are you, then, making a feature request to be able to specify values that do not have to follow megabyte boundaries?

Thank you
[1 Dec 2003 8:03] Masaki Fujimoto
I think that is not the point, but the problem is that block_size of myisam_max_sort_file_size is set to Mega Bytes in spite of the ChangeLog entry I quoted at the top this report(which says that myisam_max_sort_file_size is now given in bytes).

I have no idea that what is the correct behavior, but either current behavior, or the ChangeLog entry should be fixed in any case.
[1 Dec 2003 8:08] Dean Ellis
The changelog refers only to the way the value is specified: prior to 4.0.3 you specified a number of megabytes; now you specify a number of bytes.  The block size itself has not changed.
[1 Dec 2003 8:20] Masaki Fujimoto
Ah, now I think I've got it.

Thank you.