• Arun Kuruvila's avatar
    Bug #18463911 : SERVER CRASHES ON CREATING A TEMP TABLE · 774095a5
    Arun Kuruvila authored
                    WITH CERTAIN MAX_HEAP_TABLE_SIZE VALUES
    
    Description:
    When the  system variable 'max_heap_table_size'
    is set to 20GB, the server crashes on creation of a
    temporary tables or tables using MEMORY storage engine.
    
    Analysis:
    The variable 'max_record' determines the amount heap
    allocated for the records of the table. This value
    is determined using the 'max_heap_table_size' variable.
    'records_in_block' in turn uses the max_records to
    determine the number of records per block.
    
    When the 'max_heap_table_size' is set to 20GB, then
    the 'records_in_block' is calculated to a value of
    2^28.
    
    The size of the block determined by multiplying the
    'records_in_block' and 'recbuffer' results in overflow
    and hence the value becomes zero. As a result, zero bytes
    of the heap is allocated for the table. This will
    result in a server crash when the table is accessed.
    
    Fix:
    The variables 'records_in_block' and 'recbuffer' are
    typecasted to 'unsigned long' while calculating the
    size of the block.
    774095a5
hp_block.c 4.68 KB