• Varun Gupta's avatar
    MDEV-23753: SIGSEGV in Column_stat::store_stat_fields · 3b94309a
    Varun Gupta authored
    For EITS collection min and max fields are allocated for each column
    that is set in the read_set bitmap of a table. This allocation of min and max
    fields happens inside alloc_statistics_for_table.
    
    For a partitioned table ha_rnd_init is called inside the function
    collect_statistics_for_table which sets the read_set bitmap for the columns
    inside the partition expression. This happens only when there is a write lock
    on the partitioned table.
    But the allocation happens before this, so min and max fields are not allocated
    for the columns involved in the partition expression.
    This resulted in a crash, as the EITS statistics were collected but there was
    no min and max field to store the value to.
    
    The fix would be to call ha_rnd_init inside the function alloc_statistics_for_table
    that would make sure that min and max fields are allocated for the columns
    involved in the partition expression.
    3b94309a
sql_statistics.cc 120 KB