Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5.29
-
None
-
None
-
Linux, ppc32
Description
The test main.myisampack is failing with message:
myisamchk: error: myisam_sort_buffer_size is too small
It works fine on all other arches I tested: s390 (32 and 64), i686, x86_64 or ppc64.
Even though I don't have direct access to any ppc32 I was able to put some outputs into the code and run it on a building machine. It really seems like buffer limit (sortbuff_size variable) is 0 when entering function _create_index_by_sort() at mariadb-5.5.29/storage/myisam/sort.c:104
I suspect some bad work with memory, especially with variable sizes. Particularly sort_buffer_size defined at mariadb-5.5.29/storage/myisam/ha_myisam.cc:77 seems to be ULONGLONG but the minimum value is casted to (long).
Similar situation is in mariadb-5.5.29/storage/myisam/myisamchk.c:295 where myisam_sort_buffer_size uses casting to long but after then we use it as ulonglong.
This is probably all the info I can provide right now, but I'll be happy to test a potential patch.
I believe I've found the issue (compared myisam and aria files) and the following patch fixes the issue (test will pass on all arches):
diff -up mariadb-5.5.29/storage/myisam/myisamchk.c.sortbuffer mariadb-5.5.29/storage/myisam/myisamchk.c
--- mariadb-5.5.29/storage/myisam/myisamchk.c.sortbuffer 2013-02-27 16:46:02.258855014 +0100
+++ mariadb-5.5.29/storage/myisam/myisamchk.c 2013-02-27 16:46:23.456854430 +0100
@@ -294,13 +294,13 @@ static struct my_option my_long_options[
{ "sort_buffer_size", OPT_SORT_BUFFER_SIZE,
"Deprecated. myisam_sort_buffer_size alias is being used",
&check_param.sort_buffer_length,
- &check_param.sort_buffer_length, 0, GET_ULL, REQUIRED_ARG,
+ &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
SIZE_T_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "myisam_sort_buffer_size", OPT_SORT_BUFFER_SIZE,
"Alias of sort_buffer_size parameter",
&check_param.sort_buffer_length,
- &check_param.sort_buffer_length, 0, GET_ULL, REQUIRED_ARG,
+ &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
SIZE_T_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",