Bug #27976 Misleading error message, 'Sort buffer to small'
Submitted: 20 Apr 2007 11:39 Modified: 23 May 2007 14:15
Reporter: Johan Idrén Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:4.1,5.0,5.1 OS:Any
Assigned to: Chad MILLER CPU Architecture:Any
Tags: bfsm_2007_05_03

[20 Apr 2007 11:39] Johan Idrén
Description:
When optimizing a table, you can come across an error message stating that your 'Sort buffer' is 'to small', besides the spelling error (it should read too, not to), it does not specify which sort buffer is too small.

The general assumption is then for the user to increase sort_buffer_size, when in this case it would be more prudent to increase myisam_sort_buffer_size.

How to repeat:
mysql> optimize table rgd_018_copy1;
+--------------------------------------------+----------+----------+------------------------------+
| Table | Op | Msg_type | Msg_text |
+--------------------------------------------+----------+----------+------------------------------+
| test.rgd_018_copy1 | optimize | error | sort_buffer_size is to small |
| test.rgd_018_copy1 | optimize | status | OK |
+--------------------------------------------+----------+----------+------------------------------+
2 rows in set (0.00 sec)

Suggested fix:
Change 'Sort buffer to small' to 'myisam_sort_buffer_size too small' in mysql/sort.c
[20 Apr 2007 12:48] Mark Leith
===== sort.c 1.65 vs edited =====
--- 1.65/storage/myisam/sort.c  2007-01-24 18:57:02 +01:00
+++ edited/sort.c       2007-04-20 14:42:38 +02:00
@@ -151,7 +151,7 @@
             keys < (uint) maxbuffer)
        {
          mi_check_print_error(info->sort_info->param,
-                              "sort_buffer_size is to small");
+                              "myisam_sort_buffer_size is too small");
          goto err;
        }
       }
@@ -175,7 +175,7 @@
   }
   if (memavl < MIN_SORT_MEMORY)
   {
-    mi_check_print_error(info->sort_info->param,"Sort buffer to small"); /* purecov: tested */
+    mi_check_print_error(info->sort_info->param,"MyISAM sort buffer too small"); /* purecov: tested */
     goto err; /* purecov: tested */
   }
   (*info->lock_in_memory)(info->sort_info->param);/* Everything is allocated */
@@ -369,7 +369,7 @@
               keys < (uint) maxbuffer)
           {
             mi_check_print_error(sort_param->sort_info->param,
-                                 "sort_buffer_size is to small");
+                                 "myisam_sort_buffer_size is too small");
             goto err;
           }
         }
@@ -397,7 +397,7 @@
     if (memavl < MIN_SORT_MEMORY)
     {
       mi_check_print_error(sort_param->sort_info->param,
-                           "Sort buffer too small");
+                           "MyISAM sort buffer too small");
       goto err; /* purecov: tested */
     }
[20 Apr 2007 13:06] Mark Leith
Covering tests as well:

===== mysql-test/r/repair.result 1.24 vs edited =====
--- 1.24/mysql-test/r/repair.result     2006-10-19 17:29:10 +02:00
+++ edited/mysql-test/r/repair.result   2007-04-20 15:05:25 +02:00
@@ -79,12 +79,12 @@
 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
 ('0'),('0'),('0'),('0'),('0'),('0'),('0');
 Warnings:
-Error  1034    sort_buffer_size is to small
+Error  1034    myisam_sort_buffer_size is too small
 Error  1034    Number of rows changed from 0 to 157
 SET myisam_repair_threads=2;
 REPAIR TABLE t1;
 Table  Op      Msg_type        Msg_text
-test.t1        repair  error   sort_buffer_size is to small
+test.t1        repair  error   myisam_sort_buffer_size is too small
 test.t1        repair  warning Number of rows changed from 0 to 157
 test.t1        repair  status  OK
 SET myisam_repair_threads=@@global.myisam_repair_threads;
===== storage/myisam/sort.c 1.65 vs edited =====
--- 1.65/storage/myisam/sort.c  2007-01-24 18:57:02 +01:00
+++ edited/storage/myisam/sort.c        2007-04-20 14:42:38 +02:00
@@ -151,7 +151,7 @@
             keys < (uint) maxbuffer)
        {
          mi_check_print_error(info->sort_info->param,
-                              "sort_buffer_size is to small");
+                              "myisam_sort_buffer_size is too small");
          goto err;
        }
       }
@@ -175,7 +175,7 @@
   }
   if (memavl < MIN_SORT_MEMORY)
   {
-    mi_check_print_error(info->sort_info->param,"Sort buffer to small"); /* purecov: tested */
+    mi_check_print_error(info->sort_info->param,"MyISAM sort buffer too small"); /* purecov: tested */
     goto err; /* purecov: tested */
   }
   (*info->lock_in_memory)(info->sort_info->param);/* Everything is allocated */
@@ -369,7 +369,7 @@
               keys < (uint) maxbuffer)
           {
             mi_check_print_error(sort_param->sort_info->param,
-                                 "sort_buffer_size is to small");
+                                 "myisam_sort_buffer_size is too small");
             goto err;
           }
         }
@@ -397,7 +397,7 @@
     if (memavl < MIN_SORT_MEMORY)
     {
       mi_check_print_error(sort_param->sort_info->param,
-                           "Sort buffer too small");
+                           "MyISAM sort buffer too small");
       goto err; /* purecov: tested */
     }
[4 May 2007 21:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/26147

ChangeSet@1.2652, 2007-05-04 17:38:29-04:00, cmiller@zippy.cornsilk.net +2 -0
  Bug #27976: Misleading error message, 'Sort buffer to small'
  
  The message is gramatically wrong, and factually wrong.
  
  Change it to refer to the myisam_sort_buffer_size variable and change
  "to" to "too".
[7 May 2007 16:50] Chad MILLER
Queued to maintenance 4.1, 5.0, and 5.1 trees.
[22 May 2007 17:01] Bugs System
Pushed into 5.1.19-beta
[22 May 2007 17:03] Bugs System
Pushed into 5.0.44
[22 May 2007 17:04] Bugs System
Pushed into 4.1.23
[23 May 2007 14:15] Paul DuBois
No changelog entry needed.