Skip to content
  • Tor Didriksen's avatar
    357f6520
    Bug#21143151 ASSERTION FAILED: BITMAP_IS_CLEAR_ALL(&SORT_FORM->TMP_SET) · 357f6520
    Tor Didriksen authored
    Problem:
    For some queries where sorting/grouping require a temporary table,
    we might actually end up with a temporary table without any columns.
    That means that the 'read_set' 'tmp_set' and 'cond_set' bitmaps for
    the temporary table are zero-length, which is not supported by our
    bitmap implementation. If such a temporary table is passed on to
    filesort() for sorting, we may hit undefined behaviour, because
    we access the bits of a zero-length bitmap.
    
    Solution:
    Handle zero-length bitmaps in filesort().
    If the bitmap is empty, we are only sorting constant expressions
    anyways, and the read-set of the temporary table will be empty.
    
    In the bitmap implementation:
    Make it clear that a bitmap of size zero can be initialized,
    but cannot be used. Add more DBUG_ASSERTs to ensure that no
    bits are accessed. The only exception being bitmap_init
    (which initializes the bitmap struct)
    and bitmap_clear_all/bitmap_set_all (which are no-ops)
    357f6520
    Bug#21143151 ASSERTION FAILED: BITMAP_IS_CLEAR_ALL(&SORT_FORM->TMP_SET)
    Tor Didriksen authored
    Problem:
    For some queries where sorting/grouping require a temporary table,
    we might actually end up with a temporary table without any columns.
    That means that the 'read_set' 'tmp_set' and 'cond_set' bitmaps for
    the temporary table are zero-length, which is not supported by our
    bitmap implementation. If such a temporary table is passed on to
    filesort() for sorting, we may hit undefined behaviour, because
    we access the bits of a zero-length bitmap.
    
    Solution:
    Handle zero-length bitmaps in filesort().
    If the bitmap is empty, we are only sorting constant expressions
    anyways, and the read-set of the temporary table will be empty.
    
    In the bitmap implementation:
    Make it clear that a bitmap of size zero can be initialized,
    but cannot be used. Add more DBUG_ASSERTs to ensure that no
    bits are accessed. The only exception being bitmap_init
    (which initializes the bitmap struct)
    and bitmap_clear_all/bitmap_set_all (which are no-ops)
Loading