3831 Ashish Agarwal 2012-02-02 [merge]
BUG#11754145: merge from mysql-5.5 to mysql-trunk
modified:
include/myisam.h
storage/myisam/ha_myisam.cc
storage/myisam/ha_myisam.h
storage/myisam/mi_check.c
storage/myisam/myisamchk.c
storage/myisam/myisamdef.h
storage/myisam/sort.c
3830 Alexander Barkov 2012-02-02
Post-fix for BUG#13458237.
Recording correct test results.
modified:
mysql-test/suite/engines/funcs/r/date_function.result
=== modified file 'include/myisam.h'
--- a/include/myisam.h 2011-07-04 00:25:46 +0000
+++ b/include/myisam.h 2012-02-02 12:48:48 +0000
@@ -401,14 +401,14 @@ typedef struct st_mi_check_param
ulonglong max_data_file_length;
ulonglong keys_in_use;
ulonglong max_record_length;
+ ulonglong sort_buffer_length;
my_off_t search_after_block;
my_off_t new_file_pos,key_file_blocks;
my_off_t keydata,totaldata,key_blocks,start_check_pos;
ha_rows total_records,total_deleted;
ha_checksum record_checksum,glob_crc;
ulonglong use_buffers;
- ulong read_buffer_length,write_buffer_length,
- sort_buffer_length,sort_key_blocks;
+ ulong read_buffer_length, write_buffer_length, sort_key_blocks;
uint out_flag,warning_printed,error_printed,verbose;
uint opt_sort_key,total_files,max_level;
uint testflag, key_cache_block_size;
=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc 2012-01-31 15:16:16 +0000
+++ b/storage/myisam/ha_myisam.cc 2012-02-02 12:48:48 +0000
@@ -78,10 +78,10 @@ static MYSQL_THDVAR_ULONG(repair_threads
"disables parallel repair", NULL, NULL,
1, 1, ULONG_MAX, 1);
-static MYSQL_THDVAR_ULONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG,
+static MYSQL_THDVAR_ULONGLONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG,
"The buffer that is allocated when sorting the index when doing "
"a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE", NULL, NULL,
- 8192*1024, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), ULONG_MAX, 1);
+ 8192 * 1024, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), SIZE_T_MAX, 1);
static MYSQL_SYSVAR_BOOL(use_mmap, opt_myisam_use_mmap, PLUGIN_VAR_NOCMDARG,
"Use memory mapping for reading and writing MyISAM tables", NULL, NULL, FALSE);
=== modified file 'storage/myisam/ha_myisam.h'
--- a/storage/myisam/ha_myisam.h 2011-11-08 11:37:54 +0000
+++ b/storage/myisam/ha_myisam.h 2012-02-02 12:48:48 +0000
@@ -31,7 +31,6 @@ typedef struct st_ha_create_information
#define HA_RECOVER_QUICK 8 /* Don't check rows in data file */
#define HA_RECOVER_OFF 16 /* No automatic recover */
-extern ulong myisam_sort_buffer_size;
extern TYPELIB myisam_recover_typelib;
extern const char *myisam_recover_names[];
extern ulonglong myisam_recover_options;
=== modified file 'storage/myisam/mi_check.c'
--- a/storage/myisam/mi_check.c 2012-02-02 09:03:02 +0000
+++ b/storage/myisam/mi_check.c 2012-02-02 12:48:48 +0000
@@ -2429,7 +2429,7 @@ int mi_repair_by_sort(MI_CHECK *param, r
if (_create_index_by_sort(&sort_param,
(my_bool) (!(param->testflag & T_VERBOSE)),
- (uint) param->sort_buffer_length))
+ param->sort_buffer_length))
{
param->retry_repair=1;
goto err;
=== modified file 'storage/myisam/myisamchk.c'
--- a/storage/myisam/myisamchk.c 2011-06-30 15:50:45 +0000
+++ b/storage/myisam/myisamchk.c 2012-02-02 12:48:48 +0000
@@ -297,9 +297,9 @@ static struct my_option my_long_options[
INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",
&check_param.sort_buffer_length,
- &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ &check_param.sort_buffer_length, 0, GET_ULL, REQUIRED_ARG,
(long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
- ULONG_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
+ SIZE_T_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
&check_param.sort_key_blocks,
&check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
=== modified file 'storage/myisam/myisamdef.h'
--- a/storage/myisam/myisamdef.h 2011-07-04 00:25:46 +0000
+++ b/storage/myisam/myisamdef.h 2012-02-02 12:48:48 +0000
@@ -326,9 +326,10 @@ typedef struct st_mi_sort_param
*/
ulonglong unique[MI_MAX_KEY_SEG+1];
ulonglong notnull[MI_MAX_KEY_SEG+1];
+ ulonglong sortbuff_size;
my_off_t pos,max_pos,filepos,start_recpos;
- uint key, key_length,real_key_length,sortbuff_size;
+ uint key, key_length,real_key_length;
uint maxbuffers, keys, find_length, sort_keys_length;
my_bool fix_datafile, master;
my_bool calc_checksum; /* calculate table checksum */
@@ -779,7 +780,7 @@ pthread_handler_t thr_find_all_keys(void
int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file);
int sort_write_record(MI_SORT_PARAM *sort_param);
-int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, ulong);
+int _create_index_by_sort(MI_SORT_PARAM *info, my_bool no_messages, ulonglong);
extern void mi_set_index_cond_func(MI_INFO *info, index_cond_func_t func,
void *func_arg);
=== modified file 'storage/myisam/sort.c'
--- a/storage/myisam/sort.c 2011-08-29 12:08:58 +0000
+++ b/storage/myisam/sort.c 2012-02-02 12:48:48 +0000
@@ -99,10 +99,11 @@ my_var_write(MI_SORT_PARAM *info, IO_CAC
*/
int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
- ulong sortbuff_size)
+ ulonglong sortbuff_size)
{
int error,maxbuffer,skr;
- uint memavl,old_memavl,keys,sort_length;
+ uint sort_length, keys;
+ ulonglong memavl, old_memavl;
DYNAMIC_ARRAY buffpek;
ha_rows records;
uchar **sort_keys;
@@ -134,6 +135,9 @@ int _create_index_by_sort(MI_SORT_PARAM
sort_length= info->key_length;
LINT_INIT(keys);
+ if ((memavl - sizeof(BUFFPEK)) / (sort_length + sizeof(char *)) > UINT_MAX32)
+ memavl= sizeof(BUFFPEK) + UINT_MAX32 * (sort_length + sizeof(char *));
+
while (memavl >= MIN_SORT_BUFFER)
{
if ((records < UINT_MAX32) &&
@@ -308,7 +312,8 @@ pthread_handler_t thr_find_all_keys(void
{
MI_SORT_PARAM *sort_param= (MI_SORT_PARAM*) arg;
int error;
- uint memavl,old_memavl,keys,sort_length;
+ ulonglong memavl, old_memavl;
+ uint keys, sort_length;
uint idx, maxbuffer;
uchar **sort_keys=0;
@@ -349,6 +354,10 @@ pthread_handler_t thr_find_all_keys(void
sort_length= sort_param->key_length;
maxbuffer= 1;
+ if ((memavl - sizeof(BUFFPEK)) / (sort_length +
+ sizeof(char *)) > UINT_MAX32)
+ memavl= sizeof(BUFFPEK) + UINT_MAX32 * (sort_length + sizeof(char *));
+
while (memavl >= MIN_SORT_BUFFER)
{
if ((my_off_t) (idx+1)*(sort_length+sizeof(char*)) <=
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (ashish.y.agarwal:3830 to 3831) Bug#11754145 | Ashish Agarwal | 3 Feb |