• mithun's avatar
    Bug #17708621 : EXCEEDING SORT_BUFFER_SIZE (FILE SORT) · 020edb1c
    mithun authored
                    WITH SORT ABORTED LEAKS FILE DESCRIPTORS
    
    ISSUE : IO_CACHE used for index_merge quick select
    is freed only on successful retrieval of all rows
    from index merge.
    Suppose if there is a interrupt( or failure) to
    this operation of row retrieval (let it be a
    KILL_QUERY signal) then we are not freeing the IO_CACHE
    resources allocated by index_merge quick select.
    And hence temp file associated with it is also not closed.
    This lead to a file descriptor leak.
    
    SOLUTION : As part of file sort operation now we always 
    free the IO_CACHE allocated by index_merge quick select.
    
    sql/filesort.cc:
      In filesort function we try to free if any
      IO_CACHE allocated by index_merge quick select
      and if it is not yet freed.
    020edb1c
filesort.cc 50 KB