1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-5905: Creating tmp. memory table kills the server

The reason was that a couple of variables that hold number of rows that was used to calculate buffers was uint and caused an overflow.

Fixed by changing variables that could hold number of rows from uint to ulong and also added a cast for this test.

include/heap.h:
  Reorder to get better alignment. Changed variables that could hold number of rows from uint to ulong
mysql-test/suite/heap/heap.result:
  Added test case
mysql-test/suite/heap/heap.test:
  Added test case
mysql-test/suite/plugins/t/server_audit.test:
  Added sleep as we want to have disconnect logged before we try a new connect
storage/heap/ha_heap.cc:
  Changed variables that could hold number of rows from uint to ulong
  Limit number of rows to 4G  (as most of the variables that holds rows are ulong anyway)
  reset records_changed when key_stat_version is changed to not cause increments for every row changed
storage/heap/ha_heap.h:
  changed records_changed to ulong as this can get big
storage/heap/hp_create.c:
  Changed variables that could hold number of rows from uint to ulong
  Added cast (fixed the original bug)
storage/heap/hp_delete.c:
  Changed variables that could hold number of rows from uint to ulong
storage/heap/hp_open.c:
  Removed not needed cast
storage/heap/hp_write.c:
  Changed variables that could hold number of rows from uint to ulong
support-files/compiler_warnings.supp:
  Removed extra : from supression
This commit is contained in:
Michael Widenius
2014-03-26 21:58:27 +02:00
parent 99316b51b6
commit ded448d1d0
11 changed files with 46 additions and 19 deletions

View File

@@ -102,8 +102,8 @@ typedef struct st_heap_block
HP_PTRS *root; /* Top-level block */
struct st_level_info level_info[HP_MAX_LEVELS+1];
uint levels; /* number of used levels */
uint records_in_block; /* Records in one heap-block */
uint recbuffer; /* Length of one saved record */
ulong records_in_block; /* Records in one heap-block */
ulong last_allocated; /* number of records there is allocated space for */
} HP_BLOCK;
@@ -134,14 +134,15 @@ typedef struct st_heap_share
{
HP_BLOCK block;
HP_KEYDEF *keydef;
ulong min_records,max_records; /* Params to open */
ulonglong data_length,index_length,max_table_size;
ulonglong auto_increment;
ulong min_records,max_records; /* Params to open */
ulong records; /* records */
ulong blength; /* records rounded up to 2^n */
ulong deleted; /* Deleted records in database */
uint key_stat_version; /* version to indicate insert/delete */
uint key_version; /* Updated on key change */
uint file_version; /* Update on clear */
uint records; /* records */
uint blength; /* records rounded up to 2^n */
uint deleted; /* Deleted records in database */
uint reclength; /* Length of one record */
uint changed;
uint keys,max_key_length;
@@ -156,7 +157,6 @@ typedef struct st_heap_share
LIST open_list;
uint auto_key;
uint auto_key_type; /* real type of the auto key segment */
ulonglong auto_increment;
} HP_SHARE;
struct st_hp_hash_info;
@@ -187,12 +187,12 @@ typedef struct st_heap_info
typedef struct st_heap_create_info
{
HP_KEYDEF *keydef;
ulong max_records;
ulong min_records;
uint auto_key; /* keynr [1 - maxkey] for auto key */
uint auto_key_type;
uint keys;
uint reclength;
ulong max_records;
ulong min_records;
ulonglong max_table_size;
ulonglong auto_increment;
my_bool with_auto_increment;