diff options
author | Satya B <satya.bn@sun.com> | 2009-09-03 23:34:42 +0530 |
---|---|---|
committer | Satya B <satya.bn@sun.com> | 2009-09-03 23:34:42 +0530 |
commit | 22ec06de4b75db56afc22d624130f03af2adfd84 (patch) | |
tree | 32e53614f9c24a2ce18c36a372da8a5e2a4a3707 | |
parent | 19e76565f68477432a18a79b6b6a60d9a39c6652 (diff) | |
download | mariadb-git-22ec06de4b75db56afc22d624130f03af2adfd84.tar.gz |
Fix for Bug#33785 - myisamchk show warning message
myisamchk tool generates warnings when run on an myisam files (.MYI or .MYD)
This is because of the conversion of max_value for certain options in myisamchk
from singed long to unsigned long
The max value for the options key_buffer_size, read_buffer_size, write_buffer
_size and sort_buffer_size is given as (long) ~0L which becomes -1 when casted
from signed long to longlong and then casted to ulonglong. When (ulonglong) -1
is compared with maximal value for GET_ULONG data type, we adjust it to
(ulonglong) ULONG_MAX and throw the warning.
Fixed by using the right max size.
Max values for the variables (from mysqld.cc)
----------------------------
1. key_buffer_size
5.0: ULONG_MAX
5.1: SIZE_T_MAX
6.0: SIZE_T_MAX
2. read_buffer_size and write_buffer_size
5.0: INT_MAX32
5.1: INT_MAX32
6.0: INT_MAX32
3. sort_buffer_size (aka myisam_sort_buffer_size)
5.0: UINT_MAX32
5.1: ULONG_MAX
6.0: ULONG_MAX
Note: testcase not attached
myisam/myisamchk.c:
Bug#33785 - myisamchk show warning message
Fixed the Max value for key_buffer_size, read_buffer_size, write_buffer_size and
sort_buffer_size options
-rw-r--r-- | myisam/myisamchk.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index b1a61f2f373..11d3ac2e430 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -295,7 +295,7 @@ static struct my_option my_long_options[] = { "key_buffer_size", OPT_KEY_BUFFER_SIZE, "", (gptr*) &check_param.use_buffers, (gptr*) &check_param.use_buffers, 0, GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, (long) MALLOC_OVERHEAD, - (long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0}, + ULONG_MAX, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0}, { "key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, "", (gptr*) &opt_key_cache_block_size, (gptr*) &opt_key_cache_block_size, 0, @@ -309,17 +309,17 @@ static struct my_option my_long_options[] = (gptr*) &check_param.read_buffer_length, (gptr*) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, - (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "", (gptr*) &check_param.write_buffer_length, (gptr*) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, - (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "", (gptr*) &check_param.sort_buffer_length, (gptr*) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), - (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + UINT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "", (gptr*) &check_param.sort_key_blocks, (gptr*) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG, |