1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Fixed some cache variables that could be set to higher value than what the code supported (size_t)

Fixed some cases that didn't work with > 4G buffers.
Fixed compiler warnings


include/mysql_com.h:
  Avoid compiler warning with strncmp()
sql-common/client.c:
  Fixed long comment; Added ()
sql/filesort.cc:
  Fix code to get filesort to work with big buffers
sql/sys_vars.cc:
  Fixed some cache variables that could be set to higher value than the size_t
  Limit query cache to ULONG_MAX as the query cache buffer variables are ulong
storage/federatedx/ha_federatedx.cc:
  Remove not used variable
storage/maria/ha_maria.cc:
  Fix that bulk_insert() works with big buffers
storage/maria/ma_write.c:
  Fix that bulk_insert() works with big buffers
storage/myisam/ha_myisam.cc:
  Fix that bulk_insert() works with big buffers
storage/myisam/mi_write.c:
  Fix that bulk_insert() works with big buffers
storage/sphinx/snippets_udf.cc:
  Fixed compiler warnings
This commit is contained in:
Michael Widenius
2013-06-06 15:14:23 +03:00
parent bef95a4bbe
commit 5730786041
10 changed files with 43 additions and 42 deletions

View File

@ -49,8 +49,8 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffer_file, uint count,
static ha_rows find_all_keys(SORTPARAM *param,SQL_SELECT *select,
uchar * *sort_keys, uchar *sort_keys_buf,
IO_CACHE *buffer_file, IO_CACHE *tempfile);
static int write_keys(SORTPARAM *param,uchar * *sort_keys,
uint count, IO_CACHE *buffer_file, IO_CACHE *tempfile);
static bool write_keys(SORTPARAM *param,uchar * *sort_keys,
uint count, IO_CACHE *buffer_file, IO_CACHE *tempfile);
static void make_sortkey(SORTPARAM *param,uchar *to, uchar *ref_pos);
static void register_used_fields(SORTPARAM *param);
static bool save_index(SORTPARAM *param,uchar **sort_keys, uint count,
@ -101,9 +101,9 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
bool sort_positions, ha_rows *examined_rows)
{
int error;
ulong memory_available= thd->variables.sortbuff_size;
ulong min_sort_memory;
ulong sort_buff_sz;
size_t memory_available= thd->variables.sortbuff_size;
size_t min_sort_memory;
size_t sort_buff_sz;
uint maxbuffer;
BUFFPEK *buffpek;
ha_rows num_rows= HA_POS_ERROR;
@ -200,7 +200,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
{
while (memory_available >= min_sort_memory)
{
ulong keys= memory_available / (param.rec_length + sizeof(char*));
ulonglong keys= memory_available / (param.rec_length + sizeof(char*));
table_sort.keys= (uint) min(num_rows, keys);
sort_buff_sz= table_sort.keys*(param.rec_length+sizeof(char*));
set_if_bigger(sort_buff_sz, param.rec_length * MERGEBUFF2);
@ -211,7 +211,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
if ((table_sort.sort_keys=
(uchar**) my_malloc(sort_buff_sz, MYF(0))))
break;
ulong old_memory_available= memory_available;
size_t old_memory_available= memory_available;
memory_available= memory_available/4*3;
if (memory_available < min_sort_memory &&
old_memory_available > min_sort_memory)
@ -391,7 +391,7 @@ void filesort_free_buffers(TABLE *table, bool full)
static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count,
uchar *buf)
{
ulong length= sizeof(BUFFPEK)*count;
size_t length= sizeof(BUFFPEK)*count;
uchar *tmp= buf;
DBUG_ENTER("read_buffpek_from_file");
if (count > UINT_MAX/sizeof(BUFFPEK))
@ -711,7 +711,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
1 Error
*/
static int
static bool
write_keys(SORTPARAM *param, register uchar **sort_keys, uint count,
IO_CACHE *buffpek_pointers, IO_CACHE *tempfile)
{