Bug #342 myisam_max_sort_file_size is not handled if set online
Submitted: 29 Apr 2003 3:38 Modified: 13 May 2003 9:24
Reporter: Peter Zaitsev (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:4.0.12 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[29 Apr 2003 3:38] Peter Zaitsev
Description:
REPAIR TABLE QUICK seems to fail to use values fo myisam_max_sort_file_size if they have been set online using SET command:

| myisam_max_extra_sort_file_size | 100000000000                                                   
| myisam_max_sort_file_size       | 100000000000                                                   

are shown for session as well as global values, set by:

set global myisam_max_extra_sort_file_size=100000000000;
set global myisam_max_sort_file_size=100000000000;
set session myisam_max_extra_sort_file_size=100000000000;
set session myisam_max_sort_file_size=100000000000;

Repairing the table still uses keycache:

pz@abyss:~> mysqladmin processlist;
+----+------+-----------+------+---------+------+----------------------+----------------------------+
| Id | User | Host      | db   | Command | Time | State                | Info                       |
+----+------+-----------+------+---------+------+----------------------+----------------------------+
| 1  | pz   | localhost | test | Query   | 6    | Repair with keycache | repair table reptest quick |
| 2  | pz   | localhost |      | Query   | 0    |                      | show processlist           |
+----+------+-----------+------+---------+------+----------------------+----------------------------+

Setting values as startup options make it work:

...
--myisam_max_sort_file_size=100G \
--myisam_max_extra_sort_file_size=100G \

pz@abyss:~> mysqladmin processlist;
+----+------+-----------+------+---------+------+-------------------+----------------------------+
| Id | User | Host      | db   | Command | Time | State             | Info                       |
+----+------+-----------+------+---------+------+-------------------+----------------------------+
| 1  | pz   | localhost | test | Query   | 4    | Repair by sorting | repair table reptest quick |
| 2  | pz   | localhost |      | Query   | 0    |                   | show processlist           |
+----+------+-----------+------+---------+------+-------------------+----------------------------+

How to repeat:
Try the above with table which sizes would not allow to use Repair by Sort with default options. 

This code can be used for filling the table:

create table reptest (c char(20) not null);
alter table reptest add key(c);

This code generates queries:

#include <stdio.h>

#define MAX_VALUE 10000000

#define VALUES_INSERT 100000

#define VALUES_TO_INSERT (100*1000*1000)

main()
{
  int records=0;
  int i;
  int value;

  while (records<VALUES_TO_INSERT)
  {
    /* Prepare single insert */
    printf("INSERT INTO reptest VALUES ");
    for(i=0;i<VALUES_INSERT;i++)
    {
      value=random()%MAX_VALUE;
      if (i==VALUES_INSERT-1)
        printf("(%d)",value);
      else
        printf("(%d),",value);

    }
    printf(";\n");
    records+=VALUES_INSERT;
  }

}
[13 May 2003 9:24] Michael Widenius
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html